Skip to content

Commit 2010928

Browse files
authored
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%.
1 parent 534414d commit 2010928

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ export class ClientReferenceManifestPlugin {
307307
moduleIdMapping[id] = moduleIdMapping[id] || {}
308308
moduleIdMapping[id][name] = {
309309
...manifest.clientModules[exportName],
310+
// During SSR, we don't have external chunks to load on the server
311+
// side with our architecture of Webpack / Turbopack. We can keep
312+
// this field empty to save some bytes.
313+
chunks: [],
310314
id: pluginState.serverModuleIds[ssrNamedModuleId],
311315
}
312316
}
@@ -318,6 +322,10 @@ export class ClientReferenceManifestPlugin {
318322
edgeModuleIdMapping[id] = edgeModuleIdMapping[id] || {}
319323
edgeModuleIdMapping[id][name] = {
320324
...manifest.clientModules[exportName],
325+
// During SSR, we don't have external chunks to load on the server
326+
// side with our architecture of Webpack / Turbopack. We can keep
327+
// this field empty to save some bytes.
328+
chunks: [],
321329
id: pluginState.edgeServerModuleIds[ssrNamedModuleId],
322330
}
323331
}

0 commit comments

Comments
 (0)