@@ -46,11 +46,13 @@ impl CodeSplittingCache {
4646 fn can_skip_rebuilding_legacy ( & self , this_compilation : & Compilation ) -> bool {
4747 let logger = this_compilation. get_logger ( "rspack.Compilation.codeSplittingCache" ) ;
4848
49- if !this_compilation
50- . entries
51- . keys ( )
52- . eq ( this_compilation. code_splitting_cache . entrypoints . keys ( ) )
53- {
49+ if !this_compilation. entries . keys ( ) . eq (
50+ this_compilation
51+ . build_chunk_graph_artifact
52+ . code_splitting_cache
53+ . entrypoints
54+ . keys ( ) ,
55+ ) {
5456 logger. log ( "entrypoints change detected, rebuilding chunk graph" ) ;
5557 return false ;
5658 }
@@ -171,11 +173,13 @@ impl CodeSplittingCache {
171173 fn can_skip_rebuilding_new ( & self , this_compilation : & Compilation ) -> bool {
172174 let logger = this_compilation. get_logger ( "rspack.Compilation.codeSplittingCache" ) ;
173175
174- if !this_compilation
175- . entries
176- . keys ( )
177- . eq ( this_compilation. code_splitting_cache . entrypoints . keys ( ) )
178- {
176+ if !this_compilation. entries . keys ( ) . eq (
177+ this_compilation
178+ . build_chunk_graph_artifact
179+ . code_splitting_cache
180+ . entrypoints
181+ . keys ( ) ,
182+ ) {
179183 logger. log ( "entrypoints change detected, rebuilding chunk graph" ) ;
180184 return false ;
181185 }
@@ -303,11 +307,12 @@ where
303307 . passes_enabled ( IncrementalPasses :: BUILD_CHUNK_GRAPH ) ;
304308 let new_code_splitting = compilation. options . experiments . parallel_code_splitting ;
305309 let no_change = compilation
310+ . build_chunk_graph_artifact
306311 . code_splitting_cache
307312 . can_skip_rebuilding ( compilation) ;
308313
309314 if ( incremental_code_splitting && !new_code_splitting) || no_change {
310- let cache = & mut compilation. code_splitting_cache ;
315+ let cache = & mut compilation. build_chunk_graph_artifact . code_splitting_cache ;
311316 rayon:: scope ( |s| {
312317 s. spawn ( |_| compilation. chunk_by_ukey = cache. chunk_by_ukey . clone ( ) ) ;
313318 s. spawn ( |_| compilation. chunk_graph = cache. chunk_graph . clone ( ) ) ;
@@ -335,7 +340,7 @@ where
335340 }
336341
337342 let compilation = task ( compilation) . await ?;
338- let cache = & mut compilation. code_splitting_cache ;
343+ let cache = & mut compilation. build_chunk_graph_artifact . code_splitting_cache ;
339344 rayon:: scope ( |s| {
340345 s. spawn ( |_| cache. chunk_by_ukey = compilation. chunk_by_ukey . clone ( ) ) ;
341346 s. spawn ( |_| cache. chunk_graph = compilation. chunk_graph . clone ( ) ) ;
@@ -355,7 +360,12 @@ where
355360
356361 map. insert ( mid, ( pre, post) ) ;
357362 }
358- let cache = & mut compilation. code_splitting_cache ;
363+ let cache = & mut compilation. build_chunk_graph_artifact . code_splitting_cache ;
359364 cache. module_idx = map;
360365 Ok ( ( ) )
361366}
367+
368+ #[ derive( Debug , Default ) ]
369+ pub struct BuildChunkGraphArtifact {
370+ pub code_splitting_cache : CodeSplittingCache ,
371+ }
0 commit comments