Unverified Commit 2010928d authored by Shu Ding's avatar Shu Ding Committed by GitHub

Drop the `chunks` field in the client manifest for SSR (#50959)

The `ssrModuleMapping`/`edgeSSRModuleMapping` fields store information
for the Flight client that does SSR to resolve the correct modules in
the SSR bundle. This works as a module ID mapping between the client
bundle and the SSR bundle. During the mapping, we can drop the `chunks`
field because we don't actually have external chunks to load during SSR
as everything is locally `require`'d.

This reduces the client manifest size by at least 20%.
parent 534414d5
......@@ -307,6 +307,10 @@ export class ClientReferenceManifestPlugin {
moduleIdMapping[id] = moduleIdMapping[id] || {}
moduleIdMapping[id][name] = {
...manifest.clientModules[exportName],
// During SSR, we don't have external chunks to load on the server
// side with our architecture of Webpack / Turbopack. We can keep
// this field empty to save some bytes.
chunks: [],
id: pluginState.serverModuleIds[ssrNamedModuleId],
}
}
......@@ -318,6 +322,10 @@ export class ClientReferenceManifestPlugin {
edgeModuleIdMapping[id] = edgeModuleIdMapping[id] || {}
edgeModuleIdMapping[id][name] = {
...manifest.clientModules[exportName],
// During SSR, we don't have external chunks to load on the server
// side with our architecture of Webpack / Turbopack. We can keep
// this field empty to save some bytes.
chunks: [],
id: pluginState.edgeServerModuleIds[ssrNamedModuleId],
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment