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 13] - Multiple versions of React is shipped. One page has 2x the bundle size without any libraries. #41870
Comments
Thank you for reporting and catching this - the team is working on a fix now! |
When emitting the client components entry from server compiler, merging app internal entry into main-app to avoid duplicated chunks like react are generated in both sides Related: #41870
I upgraded to Happy to create a new issue for this, if required. Total JS transferredv13.0.0: 90kB gzipped / 272kB minified v13.0.1-canary.1: 78kB gzipped / 234kB minified |
@alexparish React duplication is fixed in #42252 out on 13.0.1! |
@timneutkens Nice! v13.0.1: 70.9kB gzipped / 215kB minified |
@timneutkens Something that might cause confusion is that a chunk is built that is not served in the hello world example. You might find people re-open this issue if they spot it. I've highlighted it with a red box in my screenshot below. Do you know what it's used for? |
That's the main bundle for |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 106.0.5249.119
How are you deploying your application? (if relevant)
next start
Describe the Bug
When building my app this is the result:
Route (app) Size First Load JS ┌ ○ / 0 B 0 B ├ ○ /dashboard 105 B 66.6 kB ├ ○ /dashboard/users 186 B 141 kB // What is going on here? └ λ /dashboard/users/[id] 4.59 kB 75.7 kB + First Load JS shared by all 66.5 kB ├ chunks/main-app-fd902262245ffaed.js 64.5 kB └ chunks/webpack-8876bb8973ebf277.js 2.07 kB Route (pages) Size First Load JS ─ ○ /404 179 B 79.8 kB + First Load JS shared by all 79.6 kB ├ chunks/main-d4cdf33ec41ad030.js 77.3 kB ├ chunks/pages/_app-4e5b418629f6f9e0.js 193 B └ chunks/webpack-8876bb8973ebf277.js 2.07 kB
It appears that Next is bundling 2 instances of React for the endpoint
/dashboard/users
. This has resulted in a 2x bundle increase on this particular page, and I cannot seem to figure out why.I've fired up the bundle analyzer and see that a specific chunk includes both next.js and react + react-dom, and its not the main bundle.
I have attempted running with
swcMinify
& without. Same result.Expected Behavior
Dual versions of React should not be shipped randomly on a page.
Link to reproduction
https://github.com/sannajammeh/next-13-dual-react
To Reproduce
ANALYZE=true next build
and observe the chunk shipped with code identical tomain-...
with some exceptions in the Next runtime.The text was updated successfully, but these errors were encountered: