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