File tree 1 file changed +11
-1
lines changed
packages/vite/src/node/optimizer
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -481,7 +481,7 @@ function esbuildScanPlugin(
481
481
// for jsx/tsx, we need to access the content and check for
482
482
// presence of import.meta.glob, since it results in import relationships
483
483
// but isn't crawled by esbuild.
484
- build . onLoad ( { filter : JS_TYPES_RE } , ( { path : id } ) => {
484
+ build . onLoad ( { filter : JS_TYPES_RE } , async ( { path : id } ) => {
485
485
let ext = path . extname ( id ) . slice ( 1 )
486
486
if ( ext === 'mjs' ) ext = 'js'
487
487
@@ -494,6 +494,16 @@ function esbuildScanPlugin(
494
494
config . optimizeDeps ?. esbuildOptions ?. loader ?. [ `.${ ext } ` ] ||
495
495
( ext as Loader )
496
496
497
+ if ( contents . includes ( 'import.meta.glob' ) ) {
498
+ return {
499
+ loader,
500
+ contents :
501
+ (
502
+ await transformGlobImport ( contents , id , config . root , resolve )
503
+ ) ?. s . toString ( ) || contents
504
+ }
505
+ }
506
+
497
507
return {
498
508
loader,
499
509
contents
You can’t perform that action at this time.
0 commit comments