-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
[Bug]: RSpack produces inflated bundle sizes as compared to other bundlers in a few cases #6704
Comments
webpack/rspack generates runtime code for every small module. Maybe |
This build runs in production mode — so I assumed module concatenation would be on. |
🤔 I manually set
|
Interesting, I don't see such an option documented here — Also, would you know why this isn't enabled by default? |
It's true that rspack document is not always up-to-date, which is a problem(I don't know how the team will improve this workflow in the future). For now, we know rspack aims for alignment with webpack, so you may find some available configuration in webpack document such as https://webpack.js.org/configuration/optimization/#optimizationconcatenatemodules. As for why it's not enabled by default in production mode, I guess this option was forgotten to be adjusted at the end of the experimental phase. rspack: rspack/packages/rspack/src/config/defaults.ts Line 916 in 4fcc42c
webpack: https://github.com/webpack/webpack/blob/8241da7f1e75c5581ba535d127fa66aeb9eb2ac8/lib/config/defaults.js#L1152 I'll make a simple pull request. |
@CPunisher concatenateModules is not enabled in production because we're still testing it, we will enable it by default in production when we think it's production ready |
@hardfist 😄 That's what I'm going to ask. After I changed the default configuration, there are some test cases with strange errors. |
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
since concatedmodule is enabled by default in prouction now, I think this can be closed |
System Info
Details
Consider a blank project that only has one dependency —
underscore
.Bundling the project using rspack or a fresh rsbuild project produces an output —
This is 42 KB minified.
However, an actual ESM minified build of rsbuild is only 25KB minified —
https://unpkg.com/browse/[email protected]/underscore-esm-min.js
RSpack might be in-effecient at packing multiple small functions into a smaller space.
Reproduce link
https://github.com/pastelsky/rspack-repro-underscore
Reproduce Steps
yarn install
yarn build
The text was updated successfully, but these errors were encountered: