Skip to content

12.0.9-canary.11 5x'd size of edge SSR bundle #34185

@leo

Description

@leo

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.9 of Next.js comes with fairly small edge SSR bundles (∼ a few hundred KB in total).
  • Version 12.0.9-canary.10 doesn't exist on npm (FYI, just to clarify that there's no version in between).
  • Version 12.0.9-canary.11 made 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

CleanShot 2022-02-10 at 15 12 06@2x

Analysis of version 12.0.9-canary.9

CleanShot 2022-02-10 at 15 12 50@2x

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

  1. Clone Vercel's next-rsc-demo
  2. Upgrade the next dependency to 12.0.9-canary.9
  3. Notice that the bundle files in .next/server/chunks have a "reasonable" size
  4. Upgrade the next dependency to 12.0.9-canary.11
  5. Notice that the bundle files in .next/server/chunks have suddenly shot up to over 1 MB for one chunk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions