Skip to content

Commit

Permalink
fix(lexical): #6132 react build size regression from #6088
Browse files Browse the repository at this point in the history
Changes are based on the 492816e by @etrepum
  • Loading branch information
StyleT committed May 17, 2024
1 parent 68f0592 commit 780a874
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 780a874

Please sign in to comment.