@@ -209,6 +209,7 @@ pub struct ExternalModule {
209
209
build_info : BuildInfo ,
210
210
build_meta : BuildMeta ,
211
211
dependency_meta : DependencyMeta ,
212
+ place_in_initial : bool ,
212
213
}
213
214
214
215
#[ cacheable]
@@ -234,6 +235,7 @@ impl ExternalModule {
234
235
external_type : ExternalType ,
235
236
user_request : String ,
236
237
dependency_meta : DependencyMeta ,
238
+ place_in_initial : bool ,
237
239
) -> Self {
238
240
Self {
239
241
dependencies : Vec :: new ( ) ,
@@ -255,6 +257,7 @@ impl ExternalModule {
255
257
build_meta : Default :: default ( ) ,
256
258
source_map_kind : SourceMapKind :: empty ( ) ,
257
259
dependency_meta,
260
+ place_in_initial,
258
261
}
259
262
}
260
263
@@ -765,15 +768,15 @@ impl Module for ExternalModule {
765
768
}
766
769
767
770
fn chunk_condition ( & self , chunk_key : & ChunkUkey , compilation : & Compilation ) -> Option < bool > {
768
- if self . external_type == "css-import" {
769
- return Some ( true ) ;
771
+ match self . external_type . as_str ( ) {
772
+ "css-import" | "module" | "import" | "module-import" if !self . place_in_initial => Some ( true ) ,
773
+ _ => Some (
774
+ compilation
775
+ . chunk_graph
776
+ . get_number_of_entry_modules ( chunk_key)
777
+ > 0 ,
778
+ ) ,
770
779
}
771
- Some (
772
- compilation
773
- . chunk_graph
774
- . get_number_of_entry_modules ( chunk_key)
775
- > 0 ,
776
- )
777
780
}
778
781
779
782
fn source ( & self ) -> Option < & BoxSource > {
0 commit comments