Skip to content

Commit

Permalink
fix: onResolve is not called for glob imports
Browse files Browse the repository at this point in the history
  • Loading branch information
XiSenao committed Dec 10, 2023
1 parent 3e42611 commit 2f5271b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,6 @@ function esbuildScanPlugin(
external: doExternalize(path),
}
})
// onResolve is not called for glob imports.
// we need to add that here as well until esbuild calls onResolve for glob imports.
// https://github.com/evanw/esbuild/issues/3317
build.onLoad({ filter, namespace: 'file' }, () => {
const externalOnLoadResult: OnLoadResult = {
loader: 'js',
contents: 'export default {}',
}
return externalOnLoadResult
})
}

// css
Expand Down Expand Up @@ -647,6 +637,16 @@ function esbuildScanPlugin(
contents,
}
})

// onResolve is not called for glob imports.
// we need to add that here as well until esbuild calls onResolve for glob imports.
// https://github.com/evanw/esbuild/issues/3317
build.onLoad({ filter: /.*/, namespace: 'file' }, () => {
return {
loader: 'js',
contents: 'export default {}',
}
})
},
}
}
Expand Down

0 comments on commit 2f5271b

Please sign in to comment.