Skip to content

Commit 66e16c1

Browse files
committed
fix: onResolve is not called for glob imports
1 parent 3e42611 commit 66e16c1

File tree

1 file changed

+11
-10
lines changed
  • packages/vite/src/node/optimizer

1 file changed

+11
-10
lines changed

packages/vite/src/node/optimizer/scan.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -561,16 +561,6 @@ function esbuildScanPlugin(
561561
external: doExternalize(path),
562562
}
563563
})
564-
// onResolve is not called for glob imports.
565-
// we need to add that here as well until esbuild calls onResolve for glob imports.
566-
// https://github.com/evanw/esbuild/issues/3317
567-
build.onLoad({ filter, namespace: 'file' }, () => {
568-
const externalOnLoadResult: OnLoadResult = {
569-
loader: 'js',
570-
contents: 'export default {}',
571-
}
572-
return externalOnLoadResult
573-
})
574564
}
575565

576566
// css
@@ -647,6 +637,17 @@ function esbuildScanPlugin(
647637
contents,
648638
}
649639
})
640+
641+
// onResolve is not called for glob imports.
642+
// we need to add that here as well until esbuild calls onResolve for glob imports.
643+
// https://github.com/evanw/esbuild/issues/3317
644+
build.onLoad({ filter: /.*/, namespace: 'file' }, () => {
645+
const externalOnLoadResult: OnLoadResult = {
646+
loader: 'js',
647+
contents: 'export default {}',
648+
}
649+
return externalOnLoadResult
650+
})
650651
},
651652
}
652653
}

0 commit comments

Comments
 (0)