@@ -42,6 +42,20 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
42
42
}
43
43
}
44
44
45
+ function getInternalImports ( imports : string [ ] ) : string [ ] {
46
+ const filteredImports : string [ ] = [ ]
47
+
48
+ for ( const file of imports ) {
49
+ if ( bundle [ file ] === undefined ) {
50
+ continue
51
+ }
52
+
53
+ filteredImports . push ( getChunkName ( bundle [ file ] as OutputChunk ) )
54
+ }
55
+
56
+ return filteredImports
57
+ }
58
+
45
59
function createChunk ( chunk : OutputChunk ) : ManifestChunk {
46
60
const manifestChunk : ManifestChunk = {
47
61
file : chunk . fileName
@@ -58,20 +72,17 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
58
72
}
59
73
60
74
if ( chunk . imports . length ) {
61
- const imports = [ ]
62
- for ( const file of chunk . imports ) {
63
- const importItem = bundle [ file ]
64
- importItem && imports . push ( getChunkName ( importItem as OutputChunk ) )
65
- }
66
- if ( imports . length > 0 ) {
67
- manifestChunk . imports = imports
75
+ const internalImports = getInternalImports ( chunk . imports )
76
+ if ( internalImports . length > 0 ) {
77
+ manifestChunk . imports = internalImports
68
78
}
69
79
}
70
80
71
81
if ( chunk . dynamicImports . length ) {
72
- manifestChunk . dynamicImports = chunk . dynamicImports . map ( ( file ) =>
73
- getChunkName ( bundle [ file ] as OutputChunk )
74
- )
82
+ const internalImports = getInternalImports ( chunk . dynamicImports )
83
+ if ( internalImports . length > 0 ) {
84
+ manifestChunk . dynamicImports = internalImports
85
+ }
75
86
}
76
87
77
88
const cssFiles = chunkToEmittedCssFileMap . get ( chunk )
0 commit comments