-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Description
Run next info (available from version 12.0.8 and up)
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101
Binaries:
Node: 16.14.0
npm: 8.3.1
Yarn: 1.22.17
pnpm: 6.30.1
Relevant packages:
next: 12.0.9-canary.11
react: 18.0.0-rc.0-next-fe905f152-20220107
react-dom: 18.0.0-rc.0-next-fe905f152-20220107
What version of Next.js are you using?
12.0.9-canary.11
What version of Node.js are you using?
16.14.0
What browser are you using?
Chrome (latest)
What operating system are you using?
macOS (latest)
How are you deploying your application?
Vercel
Describe the Bug
- Version
12.0.9-canary.9of Next.js comes with fairly small edge SSR bundles (∼ a few hundred KB in total). - Version
12.0.9-canary.10doesn't exist on npm (FYI, just to clarify that there's no version in between). - Version
12.0.9-canary.11made their size shoot up to over 1,3 MB (∼ x5) for just a single chunk.
Initially, I assumed this would be a problem in my own application, but after hours of investigation, I got to understand that version 12.0.9-canary.9 of Next.js didn't have this problem, and that 12.0.9-canary.11 had introduced it.
It was probably caused by #33635, is my guess.
Analysis of version 12.0.9-canary.11
Analysis of version 12.0.9-canary.9
Expected Behavior
It seems unintentional that the size of individual edge SSR bundles was increased by 5x, just to support the expected functionality when rendering.
It'd be great if they'd return to a size that's closer to their original one, since a larger bundle effects the server-rendering performance (that's part of the reason why Cloudflare Workers [and probably others too] limit them to 1 MB by default, which is now being exceeded as of 12.0.9-canary.11).
Also note that next-rsc-demo worked just fine before 12.0.9-canary.11. I understand that new functionality was added, but the penalty for that seems to be way too large.
To Reproduce
- Clone Vercel's next-rsc-demo
- Upgrade the
nextdependency to12.0.9-canary.9 - Notice that the bundle files in
.next/server/chunkshave a "reasonable" size - Upgrade the
nextdependency to12.0.9-canary.11 - Notice that the bundle files in
.next/server/chunkshave suddenly shot up to over 1 MB for one chunk

