fix(scanner): catch all external files for glob imports#15286
Merged
patak-cat merged 2 commits intovitejs:mainfrom Dec 14, 2023
Merged
fix(scanner): catch all external files for glob imports#15286patak-cat merged 2 commits intovitejs:mainfrom
patak-cat merged 2 commits intovitejs:mainfrom
Conversation
|
|
9 tasks
Member
|
I wonder if we should revert #15140 and just add the following code at the end? What do you think? // 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
}) |
66e16c1 to
28a57cb
Compare
Collaborator
Author
|
In the |
28a57cb to
2f5271b
Compare
Collaborator
Author
|
It seems that the test has returned to normal 🤔 |
Collaborator
Author
|
What else needs to be considered for the current changes? @patak-dev |
patak-cat
approved these changes
Dec 14, 2023
Member
|
Thanks for all your work in Vite lately @XiSenao! |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fixes #15281
fixes #15284
refs #15140
Starting from [email protected], it will attempt to bundle
glob importsmodules, and the special point in handlingglob importmodules is to skip calling theonResolvehook and directly call theonLoadhook. If the module cannot be captured by the existingonLoadhook, then it will prompt "No loader is configured for ".xxx” files:", which is a common issue encountered in[email protected]and later versions.Due to the inability of
esbuildto callonResolveplugin when parsingglob imports,viterelies onesbuildduring the initial pre-build phase to quickly scan the pre-built dependencies. The modification of #15140 only supports the suffixes supported by Vite. There is no additional processing for suffixes not supported by Vite, so import unsupported suffix types during the pre-build phase will result in an error when scanning dependencies. This change will handle all unconsidered suffixes as a fallback, preventingvitefrom throwing errors when scanning new suffixes during the pre-build phase.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).