-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
[Next 9] Importing react-dom would bloat the bundle size #7949
Comments
@atcastle is this fixed by the new chunking logic? |
@timneutkens This definitely shouldn't happen with granular chunks--but then, it shouldn't happen without it, either. The old SplitChunksConfig has I just tried to repro this by following the directions in the bug report on one of the integration test apps and I didn't see the behavior (even without granular chunks). Do we have an example repo that exhibits this behavior? |
Yeah it definitely shouldn't happen / duplicate |
I'm definitely seeing this in an app of mine; I'll see about putting together a reproducer. |
Indeed it cannot be reproduced with a simple example. Did some experiment. It seems that it only appears after your project reaches a certain level of complexity. I pinned down to something like
And it's like, removing any of these dependency would make pageA shrinks to normal. Even in componentA2 there's an @wyattanderson What do you see in your case? react-dom as well? It would be great if we can have a repro. |
Yeah, I'm away from the machine that has this project on it at the moment, but it's for
Removing the |
Just tried out 9.0.5, it still isn't fixed yet. Is that expected? |
@ZenoZen it's fixed in the new chunking behavior:
|
@timneutkens Thanks. Confirmed it's fixed with this config. What's the plan going forward? Is it going to be stablized? Or I should wait a little more while to upgrade |
It's going to be out of experimental soon once we have more metrics 👍 |
@timneutkens I just tried it out. One issue is the shared bundle generated, since its encoded using base64, it causes some problem with CDN. (Cloudfront doesn’t seem to work with characters like + and =) I believe the code is this line: https://github.com/zeit/next.js/blob/f94e75d8aa9ed6869c106530271f216361ce4425/packages/next/build/webpack-config.ts#L276 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Importing react-dom in a page or in one of its dependent component will cause react-dom.production.min.js to be included in the page bundle, adding about 32K gzipped size to a page.
This is pretty common, examples:
react-transition-group
also importsreact-dom
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
import ReactDOM from 'react-dom';
console.log(ReactDOM)
. Just to use that dependency.Expected behavior
react-dom should just be in the common bundle, not included again here.
This does not happen with Next 8.
Screenshots
System information
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: