Skip to content

Commit 04ab20e

Browse files
authored
fix: should ensure cache exist when incremental rebuild chunk graph (#9886)
fix: should ensure cache exist
1 parent 493c919 commit 04ab20e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/rspack_core/src/build_chunk_graph/new_code_splitter.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,13 @@ pub fn code_split(compilation: &mut Compilation) -> Result<()> {
17661766

17671767
let module_graph: &ModuleGraph<'_> = &compilation.get_module_graph();
17681768

1769-
let mut splitter = if let Some(mutations) = mutations {
1769+
let mut splitter = if !compilation
1770+
.code_splitting_cache
1771+
.new_code_splitter
1772+
.module_ordinal
1773+
.is_empty()
1774+
&& let Some(mutations) = mutations
1775+
{
17701776
let mut affected = mutations.get_affected_modules_with_module_graph(module_graph);
17711777
let removed = mutations.iter().filter_map(|mutation| match mutation {
17721778
Mutation::ModuleRemove { module } => Some(*module),

packages/rspack-test-tools/tests/cacheCases/common/basic/rspack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
experiments: {
55
cache: {
66
type: "persistent"
7-
}
7+
},
8+
incremental: true
89
}
910
};

0 commit comments

Comments
 (0)