Skip to content

[PENDING VALIDATION] Factor large repeated values in manifests#1186

Open
vicb wants to merge 1 commit intomainfrom
vicb/dedup
Open

[PENDING VALIDATION] Factor large repeated values in manifests#1186
vicb wants to merge 1 commit intomainfrom
vicb/dedup

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented Apr 10, 2026

There could be large repeared values in page_client-reference-manifest.js manifests.

This PR factor those values into separate variables to reduce the generated code size.

// ## Original code

globalThis.__RSC_MANIFEST["/page-240/page"] = {
    "moduleLoading": {
        "prefix": "",
        "crossOrigin": null
    },
    "clientModules": {
      // large value
    },
    "ssrModuleMapping": {
      // large value
    },
    "edgeSSRModuleMapping": {},
    "rscModuleMapping": {
      // large value
    },
    "edgeRscModuleMapping": {},
    "entryCSSFiles": {
        "[project]/app/favicon.ico": [],
        "[project]/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/dist/client/components/builtin/global-error": [],
        "[project]/app/page-240/page": []
    },
    "entryJSFiles": {
        "[project]/app/favicon.ico": ["static/chunks/33074d3ff5d0cd2d.js", "static/chunks/eb1e789fab5a5185.js"],
        "[project]/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/dist/client/components/builtin/global-error": [],
        "[project]/app/page-240/page": ["static/chunks/ac1a1e8b1e840533.js"]
    }
};
        
// ## Code with values factored out
const  v_c9e580fbbdad93172b59e4c2f3cc639252131ede = {
  // large value
};       
const  v_de230b1b5e02082d7a5ca6eff1215904a2545bb9 = {
  // large value
};       
const  v_e7cdc68a12f3e69937d7959a7aaafa15b61e4274 = {
  // large value
};       

// [ ...]

globalThis.__RSC_MANIFEST["/page-240/page"] = {
    "moduleLoading": {
        "prefix": "",
        "crossOrigin": null
    },
    "clientModules": v_c9e580fbbdad93172b59e4c2f3cc639252131ede,
    "ssrModuleMapping": v_de230b1b5e02082d7a5ca6eff1215904a2545bb9,
    "edgeSSRModuleMapping": {},
    "rscModuleMapping": v_e7cdc68a12f3e69937d7959a7aaafa15b61e4274,
    "edgeRscModuleMapping": {},
    "entryCSSFiles": {
        "[project]/app/favicon.ico": [],
        "[project]/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/dist/client/components/builtin/global-error": [],
        "[project]/app/page-240/page": []
    },
    "entryJSFiles": {
        "[project]/app/favicon.ico": ["static/chunks/33074d3ff5d0cd2d.js", "static/chunks/eb1e789fab5a5185.js"],
        "[project]/node_modules/.pnpm/next@16.1.6_@babel+core@7.29.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/dist/client/components/builtin/global-error": [],
        "[project]/app/page-240/page": ["static/chunks/ac1a1e8b1e840533.js"]
    }
};        

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 8371be5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

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

commit: 8371be5

@vicb vicb changed the title Factor large repeated values in manifests [PENDING VALIDATION] Factor large repeated values in manifests Apr 10, 2026
jkahn117 pushed a commit to jkahn117/opennextjs-cloudflare that referenced this pull request Apr 15, 2026
…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).
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.

1 participant