File tree Expand file tree Collapse file tree
packages/vite/src/node/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
218218
219219 if ( imports . length ) {
220220 const s = new MagicString ( code )
221+ const analyzed : Set < string > = new Set < string > ( )
221222 for ( let index = 0 ; index < imports . length ; index ++ ) {
222223 const { s : start , e : end , d : dynamicIndex } = imports [ index ]
223224 // if dynamic import polyfill is used, rewrite the import to
@@ -234,6 +235,8 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
234235 // literal import - trace direct imports and add to deps
235236 const addDeps = ( filename : string ) => {
236237 if ( filename === ownerFilename ) return
238+ if ( analyzed . has ( filename ) ) return
239+ analyzed . add ( filename )
237240 const chunk = bundle [ filename ] as OutputChunk | undefined
238241 if ( chunk ) {
239242 deps . add ( config . base + chunk . fileName )
You can’t perform that action at this time.
0 commit comments