@@ -190,6 +190,10 @@ impl ModuleConcatenationPlugin {
190
190
191
191
let mut set = IdentifierIndexSet :: default ( ) ;
192
192
for ( con, ( has_imported_names, cached_active) ) in & cached. connections {
193
+ if set. contains ( con. module_identifier ( ) ) {
194
+ continue ;
195
+ }
196
+
193
197
let is_target_active = if let Some ( runtime) = runtime {
194
198
if cached. runtime == * runtime {
195
199
// runtime is same, use cached value
@@ -374,20 +378,25 @@ impl ModuleConcatenationPlugin {
374
378
let mut incoming_connections_from_modules = HashMap :: default ( ) ;
375
379
for ( origin_module, connections) in incomings. iter ( ) {
376
380
if let Some ( origin_module) = origin_module {
377
- if chunk_graph. get_number_of_module_chunks ( * origin_module) == 0 {
381
+ let number_of_chunks = module_cache
382
+ . get ( origin_module)
383
+ . map ( |m| m. number_of_chunks )
384
+ . unwrap_or_else ( || chunk_graph. get_number_of_module_chunks ( * origin_module) ) ;
385
+
386
+ if number_of_chunks == 0 {
378
387
// Ignore connection from orphan modules
379
388
continue ;
380
389
}
381
390
382
391
let is_intersect = if let Some ( runtime) = runtime {
383
392
if let Some ( origin_runtime) = module_cache. get ( origin_module) . map ( |m| & m. runtime ) {
384
- runtime. intersection ( origin_runtime) . count ( ) > 0
393
+ ! runtime. is_disjoint ( origin_runtime)
385
394
} else {
386
395
let mut origin_runtime = RuntimeSpec :: default ( ) ;
387
396
for r in chunk_graph. get_module_runtimes_iter ( * origin_module, chunk_by_ukey) {
388
397
origin_runtime. extend ( r) ;
389
398
}
390
- runtime. intersection ( & origin_runtime) . count ( ) > 0
399
+ ! runtime. is_disjoint ( & origin_runtime)
391
400
}
392
401
} else {
393
402
false
@@ -1068,6 +1077,9 @@ impl ModuleConcatenationPlugin {
1068
1077
connection. is_active ( & module_graph, Some ( & runtime) , module_graph_cache) ,
1069
1078
) ;
1070
1079
}
1080
+ let number_of_chunks = compilation
1081
+ . chunk_graph
1082
+ . get_number_of_module_chunks ( * module_id) ;
1071
1083
(
1072
1084
* module_id,
1073
1085
NoRuntimeModuleCache {
@@ -1076,6 +1088,7 @@ impl ModuleConcatenationPlugin {
1076
1088
connections,
1077
1089
incomings,
1078
1090
active_incomings,
1091
+ number_of_chunks,
1079
1092
} ,
1080
1093
)
1081
1094
} )
@@ -1396,6 +1409,7 @@ pub struct NoRuntimeModuleCache {
1396
1409
connections : Vec < ( ModuleGraphConnection , ( bool , bool ) ) > ,
1397
1410
incomings : HashMap < Option < ModuleIdentifier > , Vec < ModuleGraphConnection > > ,
1398
1411
active_incomings : HashMap < DependencyId , bool > ,
1412
+ number_of_chunks : usize ,
1399
1413
}
1400
1414
1401
1415
async fn create_concatenated_module (
0 commit comments