From 7969ce013e41b5c693d3362d1bec73df4575e251 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Wed, 8 Jan 2025 21:23:40 +0800 Subject: [PATCH] fix incremental forget new entries --- crates/rspack_core/src/build_chunk_graph/mod.rs | 11 +++++++++++ packages/rspack/src/Compilation.ts | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/rspack_core/src/build_chunk_graph/mod.rs b/crates/rspack_core/src/build_chunk_graph/mod.rs index ad4a2d23681..64a1e44470c 100644 --- a/crates/rspack_core/src/build_chunk_graph/mod.rs +++ b/crates/rspack_core/src/build_chunk_graph/mod.rs @@ -1,6 +1,7 @@ // use rspack_core::Bundle; // use rspack_core::ChunkGraph; +use incremental::ChunkReCreation; use tracing::instrument; use crate::{incremental::IncrementalPasses, Compilation}; @@ -23,6 +24,16 @@ pub(crate) fn build_chunk_graph(compilation: &mut Compilation) -> rspack_error:: if !enable_incremental || splitter.chunk_group_infos.is_empty() { let inputs = splitter.prepare_input_entrypoints_and_modules(compilation)?; splitter.prepare_entries(inputs, compilation)?; + } else if compilation.entries.len() > compilation.entrypoints.len() { + let more_entries = compilation + .entries + .keys() + .filter(|entry| !compilation.entrypoints.contains_key(entry.as_str())) + .map(|entry| ChunkReCreation::Entry(entry.to_owned())) + .collect::>(); + for entry in more_entries { + entry.rebuild(&mut splitter, compilation)?; + } } splitter.split(compilation)?; diff --git a/packages/rspack/src/Compilation.ts b/packages/rspack/src/Compilation.ts index 97507e57cb4..21cde60a88a 100644 --- a/packages/rspack/src/Compilation.ts +++ b/packages/rspack/src/Compilation.ts @@ -1265,7 +1265,6 @@ class AddIncludeDispatcher { this.#args = []; const cbs = this.#cbs; this.#cbs = []; - console.log("args.length", args.length); this.#inner(args, (wholeErr, results) => { if (this.#args.length !== 0) { queueMicrotask(this.#execute);