@@ -298,37 +298,37 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
298
298
} ,
299
299
300
300
renderChunk ( _ , chunk , options ) {
301
- if ( ! options . inlineDynamicImports ) {
302
- for ( const id of chunk . moduleIds ) {
303
- const module = this . getModuleInfo ( id )
304
- if ( ! module ) continue
305
- // When a dynamic importer shares a chunk with the imported module,
306
- // warn that the dynamic imported module will not be moved to another chunk (#12850).
307
- if ( module . importers . length && module . dynamicImporters . length ) {
308
- // Filter out the intersection of dynamic importers and sibling modules in
309
- // the same chunk. The intersecting dynamic importers' dynamic import is not
310
- // expected to work. Note we're only detecting the direct ineffective
311
- // dynamic import here.
312
- const detectedIneffectiveDynamicImport =
313
- module . dynamicImporters . some (
314
- ( id ) => ! isInNodeModules ( id ) && chunk . moduleIds . includes ( id ) ,
315
- )
316
- if ( detectedIneffectiveDynamicImport ) {
317
- this . warn (
318
- `\n(!) ${
319
- module . id
320
- } is dynamically imported by ${ module . dynamicImporters . join (
321
- ', ' ,
322
- ) } but also statically imported by ${ module . importers . join (
323
- ', ' ,
324
- ) } , dynamic import will not move module into another chunk.\n`,
325
- )
301
+ if ( config . command === 'build' && ! config . experimental . fullBundleMode ) {
302
+ if ( ! options . inlineDynamicImports ) {
303
+ for ( const id of chunk . moduleIds ) {
304
+ const module = this . getModuleInfo ( id )
305
+ if ( ! module ) continue
306
+ // When a dynamic importer shares a chunk with the imported module,
307
+ // warn that the dynamic imported module will not be moved to another chunk (#12850).
308
+ if ( module . importers . length && module . dynamicImporters . length ) {
309
+ // Filter out the intersection of dynamic importers and sibling modules in
310
+ // the same chunk. The intersecting dynamic importers' dynamic import is not
311
+ // expected to work. Note we're only detecting the direct ineffective
312
+ // dynamic import here.
313
+ const detectedIneffectiveDynamicImport =
314
+ module . dynamicImporters . some (
315
+ ( id ) => ! isInNodeModules ( id ) && chunk . moduleIds . includes ( id ) ,
316
+ )
317
+ if ( detectedIneffectiveDynamicImport ) {
318
+ this . warn (
319
+ `\n(!) ${
320
+ module . id
321
+ } is dynamically imported by ${ module . dynamicImporters . join (
322
+ ', ' ,
323
+ ) } but also statically imported by ${ module . importers . join (
324
+ ', ' ,
325
+ ) } , dynamic import will not move module into another chunk.\n`,
326
+ )
327
+ }
326
328
}
327
329
}
328
330
}
329
- }
330
331
331
- if ( config . command === 'build' && ! config . experimental . fullBundleMode ) {
332
332
chunksReporter ( this ) . register ( )
333
333
}
334
334
} ,
0 commit comments