Skip to content

Commit

Permalink
fix(lexical): #6132 react build size regression from #6088 (#6133)
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleT authored May 17, 2024
1 parent 68f0592 commit c1f0416
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ function resolveExternalEsm(id) {
* party dependencies or peerDependencies that we do not want to include
* in the bundles.
*/
const externals = [
...Object.entries(wwwMappings).flat(),
'react-dom',
'react',
'yjs',
'y-websocket',
].sort();
const monorepoExternalsSet = new Set(Object.entries(wwwMappings).flat());
const thirdPartyExternals = ['react', 'react-dom', 'yjs', 'y-websocket'];
const thirdPartyExternalsRegExp = new RegExp(
`^(${thirdPartyExternals.join('|')})(\\/|$)`,
);

const strictWWWMappings = {};

Expand Down Expand Up @@ -131,7 +129,10 @@ async function build(name, inputFile, outputPath, outputFile, isProd, format) {
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
const inputOptions = {
external(modulePath, src) {
return externals.includes(modulePath);
return (
monorepoExternalsSet.has(modulePath) ||
thirdPartyExternalsRegExp.test(modulePath)
);
},
input: inputFile,
onwarn(warning) {
Expand Down

0 comments on commit c1f0416

Please sign in to comment.