Skip to content

feat(manifest): extend manifest deduplication with edge mappings, ent…#1212

Closed
vicb wants to merge 1 commit intoopennextjs:vicb/dedupfrom
jkahn117:extend-dedup
Closed

feat(manifest): extend manifest deduplication with edge mappings, ent…#1212
vicb wants to merge 1 commit intoopennextjs:vicb/dedupfrom
jkahn117:extend-dedup

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented Apr 20, 2026

…ry files, and chunks arrays

…ry files, and chunks arrays

- Replace empty edgeSSRModuleMapping/edgeRscModuleMapping with shared __EMPTY variable
- Factor entryCSSFiles and entryJSFiles through existing factorManifestValue
- Deduplicate repeated chunks arrays within module mappings into shared c_<hash> variables
Builds on opennextjs#1186 (vicb/dedup).
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

⚠️ No Changeset found

Latest commit: fbe2d67

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@1212

commit: fbe2d67

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Apr 20, 2026

@jkahn117 what repo/branch have you used to test the changes here? Do you have a path to a manifest showing size reduction vs the base PR?
Thanks!

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Apr 20, 2026

@jkahn117 This is what I find when testing this PR rebased on main on https://github.com/jkahn117/opennext-static-assets-test (branch many-many-routes)

The reported size is for .open-next/server-functions/default/handler.mjs.

What am I doing wrong?

@mgallagher
Copy link
Copy Markdown

Hey @vicb, sharing our results comparing this PR and #1186 using the output of wrangler deploy --dry-run. These additional optimizations seem to result in a larger size reduction than #1186 alone.

Baseline

Next 16.2.4
@opennext/cloudflare 1.19.2

Turbopack:
Total Upload: 58427.44 KiB / gzip: 9224.35 KiB

Webpack:
Total Upload: 66146.16 KiB / gzip: 9213.08 KiB

PR #1186

Turbopack:
Total Upload: 51945.86 KiB / gzip: 8854.45 KiB
Reduction from baseline: 11.09% / 4.01%

Webpack:
Total Upload: 55750.28 KiB / gzip: 7922.17 KiB
Reduction from baseline: 15.72% / 14.01%

This PR / extend manifest deduplication

Turbopack:
Total Upload: 43534.87 KiB / gzip: 8621.57 KiB
Reduction from PR #1186: 16.20% / 2.63%
Reduction from baseline: 25.49% / 6.54%

Webpack:
Total Upload: 42659.59 KiB / gzip: 7715.89 KiB 👑
Reduction from PR #1186: 23.48% / 2.60%
Reduction from baseline: 35.51% / 16.25%

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Apr 20, 2026

Hey @vicb, sharing our results comparing this PR and #1186 using the output of wrangler deploy --dry-run. These additional optimizations seem to result in a larger size reduction than #1186 alone.

Thanks for the feedback @mgallagher - it would be hard for me to justify merging a PR penalizing every other apps as of now. Maybe you can DM me a few manifest files before/after this PR.

I'll also check if I can find an heuristic to opt-out of the optimizations in this PR when they do not benefit the bundle size.

@jkahn117
Copy link
Copy Markdown

@vicb Agree, not beneficial to include if it penalizes other apps right now. It was targeted to help with @mgallagher 's case, so possible that it was over specific.

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Apr 20, 2026

@mgallagher could you please try #1215 and let us know the numbers. The PR descriptiob has details about the changes.
Thanks.

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented Apr 21, 2026

See #1215 instead

@vicb vicb closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants