diff --git a/crates/turbopack-core/src/chunk/list/update.rs b/crates/turbopack-core/src/chunk/list/update.rs index c73596aac1b06d..8a6ac7c190b12d 100644 --- a/crates/turbopack-core/src/chunk/list/update.rs +++ b/crates/turbopack-core/src/chunk/list/update.rs @@ -77,6 +77,13 @@ pub(super) async fn update_chunk_list( let content = content.await?; + // There are two kind of updates nested within a chunk list update: + // * merged updates; and + // * single chunk updates. + // In order to compute merged updates, we first need to group mergeable chunks + // by common mergers. Then, we compute the update of each group separately. + // Single chunk updates are computed separately and only require a stable chunk + // path to identify the chunk across versions. let mut by_merger = IndexMap::<_, Vec<_>>::new(); let mut by_path = IndexMap::<_, _>::new(); diff --git a/crates/turbopack-ecmascript/src/chunk/evaluate.rs b/crates/turbopack-ecmascript/src/chunk/evaluate.rs index e6182203a57a69..acce049b6031b6 100644 --- a/crates/turbopack-ecmascript/src/chunk/evaluate.rs +++ b/crates/turbopack-ecmascript/src/chunk/evaluate.rs @@ -24,7 +24,8 @@ pub struct EcmascriptChunkEvaluate { /// All chunks of this chunk group need to be ready for execution to start. /// When None, it will use a chunk group created from the current chunk. pub chunk_group: Option, - /// The path to the chunk list file. + /// The path to the chunk list asset. This will be used to register the + /// chunk list when this chunk is evaluated. pub chunk_list_path: Option, } diff --git a/crates/turbopack-ecmascript/src/chunk/manifest/loader_item.rs b/crates/turbopack-ecmascript/src/chunk/manifest/loader_item.rs index 911ea0b1c09511..7b67d5043e4f6d 100644 --- a/crates/turbopack-ecmascript/src/chunk/manifest/loader_item.rs +++ b/crates/turbopack-ecmascript/src/chunk/manifest/loader_item.rs @@ -83,6 +83,7 @@ impl ChunkItem for ManifestLoaderItem { } .cell() .into(), + // This creates the chunk list corresponding to the manifest chunk's chunk group. ChunkListReferenceVc::new( this.context.output_root(), this.manifest.chunk_group(), diff --git a/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs b/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs index eadde3e37f4dfd..4a7799827e80f7 100644 --- a/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs +++ b/crates/turbopack-ecmascript/src/chunk_group_files_asset.rs @@ -168,6 +168,7 @@ impl ChunkItem for ChunkGroupFilesChunkItem { .map(Into::into) .collect(); + // This creates the chunk list corresponding to this chunk group. references.push( ChunkListReferenceVc::new( self.inner.await?.server_root,