fix: early discovery of missing deps, fix #7333 #7346
Merged
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
Related #7345
This PR moves the rewrite of URL imports to happen after the eager transformation of imported modules. These rewrites need to know if es interop is needed, so awaiting for them is blocked by pre-bundling processing. After this PR, missing dependencies can be discovered in batch avoiding full reloads. This also allows Vite to process more requests while dependencies are being pre-bundled on cold start.
#7333 worked fine with beta-0 because invalidation wasn't being handled properly, with beta-2 and a file like:
When each import was analyzed, the new dep will be discovered but import analysis will be blocked until we know if it needs es-interop... and because a full reload was needed, each new import in this file will end up generating a full reload.
What is the purpose of this pull request?