Skip to content

Commit

Permalink
React: Restore umd builds (#63602)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
  • Loading branch information
4 people authored Jul 16, 2024
1 parent c4332b6 commit 7351780
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
15 changes: 14 additions & 1 deletion tools/webpack/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ const exportDefaultPackages = [
'warning',
];

const copiedVendors = {
'react.js': 'react/umd/react.development.js',
'react.min.js': 'react/umd/react.production.min.js',
'react-dom.js': 'react-dom/umd/react-dom.development.js',
'react-dom.min.js': 'react-dom/umd/react-dom.production.min.js',
};

module.exports = {
...baseConfig,
name: 'packages',
Expand Down Expand Up @@ -148,7 +155,13 @@ module.exports = {
transform: stylesTransform,
noErrorOnMissing: true,
} ) )
.concat( bundledPackagesPhpConfig ),
.concat( bundledPackagesPhpConfig )
.concat(
Object.entries( copiedVendors ).map( ( [ to, from ] ) => ( {
from: `node_modules/${ from }`,
to: `build/vendors/${ to }`,
} ) )
),
} ),
new MomentTimezoneDataPlugin( {
startYear: 2000,
Expand Down
11 changes: 3 additions & 8 deletions tools/webpack/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -35,12 +33,9 @@ module.exports = [
},
},

externals:
name === 'react'
? {}
: {
react: 'React',
},
externals: {
react: 'React',
},
};
} );
} ),
Expand Down

0 comments on commit 7351780

Please sign in to comment.