@@ -494,17 +494,6 @@ export default class MiniSplitChunksPlugin extends SplitChunksPlugin {
494
494
const chunkName = `${ entryName } ${ ext } `
495
495
const chunkAbsolutePath = path . resolve ( this . distPath , chunkName )
496
496
const subVendorsPath = path . join ( subRoot , `${ SUB_VENDORS_NAME } ${ ext } ` )
497
- // 将子包 vendors 插入到 entry 中
498
- if ( assets [ normalizePath ( subVendorsPath ) ] ) {
499
- const subVendorsAbsolutePath = path . resolve ( this . distPath , subVendorsPath )
500
- const vendorsRelativePath = this . getRealRelativePath ( chunkAbsolutePath , subVendorsAbsolutePath )
501
- if ( ext === FileExtsMap . STYLE ) {
502
- source . add ( `@import ${ JSON . stringify ( `${ vendorsRelativePath } ` ) } ;` )
503
- }
504
- if ( ext === FileExtsMap . JS ) {
505
- source . add ( `require(${ JSON . stringify ( `${ vendorsRelativePath } ` ) } );` )
506
- }
507
- }
508
497
// 将子包下的 common 模块替换为父包下的 common 模块
509
498
subCommon . forEach ( moduleName => {
510
499
const moduleFileName = `${ moduleName } ${ ext } `
@@ -544,6 +533,17 @@ export default class MiniSplitChunksPlugin extends SplitChunksPlugin {
544
533
}
545
534
}
546
535
} )
536
+ // 将子包 vendors 插入到 entry 中
537
+ if ( assets [ normalizePath ( subVendorsPath ) ] ) {
538
+ const subVendorsAbsolutePath = path . resolve ( this . distPath , subVendorsPath )
539
+ const vendorsRelativePath = this . getRealRelativePath ( chunkAbsolutePath , subVendorsAbsolutePath )
540
+ if ( ext === FileExtsMap . STYLE ) {
541
+ source . add ( `@import ${ JSON . stringify ( `${ vendorsRelativePath } ` ) } ;` )
542
+ }
543
+ if ( ext === FileExtsMap . JS ) {
544
+ source . add ( `require(${ JSON . stringify ( `${ vendorsRelativePath } ` ) } );` )
545
+ }
546
+ }
547
547
if ( assets [ chunkName ] ) {
548
548
const originSource = assets [ chunkName ] . source ( )
549
549
if ( ext === FileExtsMap . STYLE && typeof originSource === 'string' ) {
0 commit comments