next.js
d9751eaa - Turbopack: use ChunkGroupEntry::Shared, part 2 (#91279)

Commit
52 days ago
Turbopack: use ChunkGroupEntry::Shared, part 2 (#91279) Followup to https://github.com/vercel/next.js/pull/90978, which fixed the `ChunkGroup`s passed to `.chunk_group()`, forgot to update the the module graph entry types, which didn't match up. The `ChunkGroupEntry::Shared(ResolvedVc::upcast(*server_component))` one was more involved: - We used to have `layout.js [app-rsc] (Next.js Server Component)` --ChunkingType::Shared--> `layout.js [app-rsc]` (the actual module) - But this meant that the actual chunk group was `Shared(server_component.await?.module)` (the inner one) - This wasn't possible to use for the module graph construction though, as the client reference transform needs to see the `layout.js [app-rsc] (Next.js Server Component)` module during the traversal, to infer the parent server component of the given subgraph. So instead, move to - `loader-tree in the template` - --ChunkingType::Shared--> - `layout.js [app-rsc] (Next.js Server Component)` - --ChunkingType::Parallel--> - `layout.js [app-rsc]` The reason for that `ChunkingType::Shared` is so that we can chunk arbitrary modules that are loaded by `ChunkGroup::Entry`. Meaning that we can do `chunk_group(Shared(root_layout))).concat(chunk_group(Shared(layout))).concat(chunk_group(Entry(page)))` and rely on turbotask caching to deduplicate layout chunking across pages.
Author
Parents
Loading