@@ -1235,6 +1235,9 @@ impl PageEndpoint {
12351235 async fn build_manifest (
12361236 & self ,
12371237 client_chunks : ResolvedVc < OutputAssets > ,
1238+ // The inline chunk group bootstrap params for this page, when the client chunking
1239+ // context inlines the bootstrap instead of emitting a per-route chunk.
1240+ chunk_group_bootstrap_params : Option < RcStr > ,
12381241 ) -> Result < Vc < Box < dyn OutputAsset > > > {
12391242 let node_root = self . pages_project . project ( ) . node_root ( ) . owned ( ) . await ?;
12401243 let client_relative_path = self
@@ -1246,11 +1249,27 @@ impl PageEndpoint {
12461249
12471250 // Check if we should include pages in the manifest
12481251 let pages_structure = self . pages_structure . await ?;
1249- let pages = if pages_structure. should_create_pages_entries {
1250- fxindexmap ! ( self . pathname. clone( ) => client_chunks)
1251- } else {
1252- fxindexmap ! [ ] // Empty pages when no user pages should be created
1253- } ;
1252+ let ( pages, pages_chunk_group_bootstrap_params) =
1253+ if pages_structure. should_create_pages_entries {
1254+ (
1255+ fxindexmap ! ( self . pathname. clone( ) => client_chunks) ,
1256+ chunk_group_bootstrap_params
1257+ . map ( |params| fxindexmap ! ( self . pathname. clone( ) => params) )
1258+ . unwrap_or_default ( ) ,
1259+ )
1260+ } else {
1261+ // Empty when no user pages should be created
1262+ ( fxindexmap ! [ ] , fxindexmap ! [ ] )
1263+ } ;
1264+
1265+ let chunk_loading_global = ( * self
1266+ . pages_project
1267+ . project ( )
1268+ . next_config ( )
1269+ . turbopack_chunk_loading_global ( )
1270+ . await ?)
1271+ . clone ( )
1272+ . unwrap_or_else ( || rcstr ! ( "TURBOPACK" ) ) ;
12541273
12551274 let manifest_path_prefix = get_asset_prefix_from_pathname ( & self . pathname ) ;
12561275 let build_manifest = BuildManifest {
@@ -1262,6 +1281,8 @@ impl PageEndpoint {
12621281 polyfill_files : Default :: default ( ) ,
12631282 root_main_files : Default :: default ( ) ,
12641283 root_main_files_per_page : Default :: default ( ) ,
1284+ pages_chunk_group_bootstrap_params,
1285+ chunk_loading_global,
12651286 } ;
12661287 Ok ( Vc :: upcast ( build_manifest. cell ( ) ) )
12671288 }
@@ -1316,9 +1337,15 @@ impl PageEndpoint {
13161337 PageEndpointType :: Html => {
13171338 let client_chunk_group = self . client_chunk_group ( ) ;
13181339 client_assets. extend ( client_chunk_group. all_assets ( ) . await ?. iter ( ) . copied ( ) ) ;
1319- let client_chunks = * client_chunk_group. await ?. assets ;
1340+ let client_chunk_group_ref = client_chunk_group. await ?;
1341+ let client_chunks = * client_chunk_group_ref. assets ;
1342+ let chunk_group_bootstrap_params =
1343+ client_chunk_group_ref. chunk_group_bootstrap_params . clone ( ) ;
13201344
1321- let build_manifest = self . build_manifest ( client_chunks) . to_resolved ( ) . await ?;
1345+ let build_manifest = self
1346+ . build_manifest ( client_chunks, chunk_group_bootstrap_params)
1347+ . to_resolved ( )
1348+ . await ?;
13221349 let page_loader = self . page_loader ( client_chunks) . to_resolved ( ) . await ?;
13231350 let client_build_manifest = self
13241351 . client_build_manifest ( * page_loader)
0 commit comments