Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lexical): #6132 react build size regression from #6088 #6133

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading