diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js index 17913885eb187..de8f9d44ebd76 100644 --- a/tools/webpack/packages.js +++ b/tools/webpack/packages.js @@ -96,6 +96,8 @@ module.exports = function ( 'wp-polyfill-importmap.js': 'es-module-shims/dist/es-module-shims.wasm.js', 'moment.js': 'moment/moment.js', 'regenerator-runtime.js': 'regenerator-runtime/runtime.js', + 'react.js': 'react/umd/react.development.js', + 'react-dom.js': 'react-dom/umd/react-dom.development.js', }; const minifiedVendors = { @@ -109,6 +111,8 @@ module.exports = function ( 'objectFitPolyfill/dist/objectFitPolyfill.min.js', 'wp-polyfill-inert.min.js': 'wicg-inert/dist/inert.min.js', 'moment.min.js': 'moment/min/moment.min.js', + 'react.min.js': 'react/umd/react.production.min.js', + 'react-dom.min.js': 'react-dom/umd/react-dom.production.min.js', }; const minifyVendors = { diff --git a/tools/webpack/vendors.js b/tools/webpack/vendors.js index 4fc5bded7535c..1c1f0a187a176 100644 --- a/tools/webpack/vendors.js +++ b/tools/webpack/vendors.js @@ -4,8 +4,6 @@ const { join } = require( 'path' ); const importedVendors = { - react: { import: 'react', global: 'React' }, - 'react-dom': { import: 'react-dom', global: 'ReactDOM' }, 'react-jsx-runtime': { import: 'react/jsx-runtime', global: 'ReactJSXRuntime', @@ -21,7 +19,7 @@ module.exports = function ( : mode === 'production' ? 'build' : 'src'; - buildTarget = buildTarget + '/wp-includes/js/dist/vendor/'; + buildTarget = buildTarget + '/wp-includes/js/dist/vendor/'; return [ ...Object.entries( importedVendors ).flatMap( ( [ name, config ] ) => { return [ 'production', 'development' ].map( ( currentMode ) => { @@ -45,12 +43,9 @@ module.exports = function ( }, }, - externals: - name === 'react' - ? {} - : { - react: 'React', - }, + externals: { + react: 'React', + }, }; } ); } ),