-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use consistent virtual module ID in module graph #13073
fix: use consistent virtual module ID in module graph #13073
Conversation
Run & review this pull request in StackBlitz Codeflow. |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Ecosystem CI looks good. The Nuxt failure is in main too 👍🏼 |
7cc1d96
to
173a02f
Compare
@bluwy could you explain why that would be better? I think it is more clear to me if the client already receives |
Hmm yeah after refreshing myself of what values the Also I tested with |
Description
When investigating #12912, I found that when accepting
virtual:my-plugin:foo
like belowThis will lead to adding a
/src/virtual:my-plugin:foo
generated by the following code to the module graph, however, IIUC, virtual module's URL should not be calculated with the importer.vite/packages/vite/src/node/plugins/importAnalysis.ts
Lines 744 to 747 in 229c592
In this PR, the test case is modified to only update the virtual module as below.
To fix #12912 ideally, we shall only use
'virtual:file'
but the HMR dilemma now is like this:acceptedPath
send to the client is"/@id/__x00__virtual:file"
acceptedPath
defined inmain.js
must include"/@id/__x00__virtual:file"
to receive the update.I'm not sure what's the best way to fix this, but I think it's straightforward to avoid assembling URL for virtual file with the importer in this PR. Looking forward to some feedback 🙌.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).