rspack: [Bug]: `parallelCodeSplitting` increases js output size
System Info
Rspack 1.2.8 with explicit opt-in experiments.parallelCodeSplitting = true or 1.3 with default (true)
Details
When parallelCodeSplitting it turned on, the JS output size increases
This has been caught by our CI bundle size checker while upgrading to v1.3 (see https://github.com/facebook/docusaurus/pull/11039), but also reproduces when turning the option on manually on v1.2.8
The diff increase looks related to code splitting
Reproduce link
No response
Reproduce Steps
clone https://github.com/facebook/docusaurus
Change rspack version in docusaurus/packages/docusaurus-faster/package.json
Run on Rspack 1.2.8
yarn install
yarn build:website:fast
Save website/build/assets/js/main.*.js
Run on Rspack 1.3.x
yarn install
yarn build:website:fast
Save website/build/assets/js/main.*.js
Diff both files, the v1.3.0 one is larger than the 1.2.8 one.
Disabling parallelCodeSplitting on v1.3 gives an output that looks like before (ignoring positive changes related to output.environment)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
Let’s keep this issue as we still need to add more documentation for the current parallelCodeSplitting impact. 😄
Oh persistent case, I think it’s fixed by #9886
Let me explain the history here.
removeAvailableModuleswas the option to optimize chunk modules in early webpack, enable it will add a plugin to remove modules that already in parent chunks. Later, webpack has refactored code splitting algorithm, after then, code splitting can skip visiting modules that already exist in parent chunks entirely, theremoveAvailableModulesis no need then as its functionality is already covered by code splitting itself.Should keep it false for webpack, as it will add an unnecessary plugin to do the duplicated work.
For Rspack, well, I think we need to discuss further whether we should keep this config or not
Thanks, I’ll check it out
The
.docusaurusfolder is generated by Docusaurus core based on content and logic of plugins.The
routes.jsfile is generated based on all routes created by various plugins:Other files that might be related to this problem:
registry.jsandroutesChunkNames.jsonThe code that generates all these files from plugin routes is located in
docusaurus/packages/docusaurus/src/server/codegen