-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Treeshaking multiple entry modules with multiple re-exports creates extra chunks (follow-up) #5007
Comments
It seems to trigger the issue the second export doesn't even have to be a re-export. A normal export also triggers it: |
This one is a little more subtle and I will probably not fix it for reasons I will explain. What Rollup is doing here is that it is trying to minimize the amount of JavaScript loaded per entry (not counting imports and exports). In your example In the output generated by Rollup, loading So this is a slightly failed attempt to reduce size, but it can actually have quite some effects if the declarations were more involved. In your example, I would try to set |
Rollup Version
3.23.0
Operating System (or Browser)
Chrome 113
Node Version (if applicable)
N/A
Link To Reproduction
https://rollupjs.org/repl/?version=3.23.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGRvdWJsZSUyMCU3RCUyMGZyb20lMjAnLiUyRm1hdGguanMnJTNCJTVDbiU1Q25jb25zb2xlLmxvZyhkb3VibGUoNSkpJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlMkMlMjJuYW1lJTIyJTNBJTIybWFpbi5qcyUyMiU3RCUyQyU3QiUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjAlN0IlMjBkb3VibGUlMjAlN0QlMjBmcm9tJTIwJy4lMkZtYXRoJTJGbXVsdGlwbGljYXRpb24uanMnJTNCJTVDbmV4cG9ydCUyMCU3QiUyMHN1bSUyMCU3RCUyMGZyb20lMjAnLiUyRm1hdGglMkZhZGRpdGlvbi5qcyclM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYXRoLmpzJTIyJTdEJTJDJTdCJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGNvbnN0JTIwZG91YmxlJTIwJTNEJTIweCUyMCUzRCUzRSUyMHglMjAqJTIwMiUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0FmYWxzZSUyQyUyMm5hbWUlMjIlM0ElMjJtYXRoJTJGbXVsdGlwbGljYXRpb24uanMlMjIlN0QlMkMlN0IlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwY29uc3QlMjBzdW0lMjAlM0QlMjAoeCUyQyUyMHkpJTIwJTNEJTNFJTIweCUyMCUyQiUyMHklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBZmFsc2UlMkMlMjJuYW1lJTIyJTNBJTIybWF0aCUyRmFkZGl0aW9uLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMm91dHB1dCUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTdEJTJDJTIydHJlZXNoYWtlJTIyJTNBdHJ1ZSU3RCU3RA==
Expected Behaviour
We expect an output of 2 chunks (main.js & math.js) where the internal used module
math/multiplication.js
is bundled intomath.js
Actual Behaviour
When treeshaking is active, Rollup creates an extra chunk for the used internal module (
math/multiplication.js
) and references this chunk instead of the originally referenced module (math.js
)This is a follow-up bug on issue #4962. The difference here is that
math.js
contains a second re-export from another file (math/addition.js
) When commenting out thissum
re-export (or disabling treeshaking) we have the expected behaviour.The text was updated successfully, but these errors were encountered: