-
-
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(node): remove timestamp query of staticImportedUrls
#15663
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Ah now that I see, you are right. However, to me, my fix doesn't look like it works. Can you pickup my fix and apply to yours? I don't really use vue so I can't tell. |
When vue calls Where calling In I don't think this is a vite problem. I have followed @bluwy 's instruction. However, because |
My thought of fix would be adding a more condition to defining to something like function hasVariable(template) {
return template.includes("{{");
}
if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor) && !hasVariable(descriptor.template)) {
output.push(`export const _rerender_only = true`);
} Or something like // some how inject the filename (changedFilename) that caused hmr
const isDependencyChanged = changedFilename !== filename;
if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor) && !isDependencyChanged) {
output.push(`export const _rerender_only = true`);
} Though, I don't really know because it is not related to vite anymore. |
you are right, i think there is two bugs here:
so i think, this fix only focus vite, which make sure app.vue can soft invalidate itself. |
@chaejunlee Sorry for the late reply (and leading you to a rabbithole). I just tested the repro, and the For example, in the soft-invalidate playground before this PR, you can try to edit
Perhaps I'm missing something about the Vue case here? The imports are currently only parsed by us, so I think Vue shouldn't be interfering it.
When you update |
@bluwy No worries. I respect your time. I think I was too focused on the issue and didn't see what the fix actually does. I think what you found out of the issue doesn't necessarily solve the issue but it was definitely a bug. Thanks for pointing it out. I have added a test to verify the fix. I think this fix is what vite can do for the issue. What I found out is that vue-plugin tries to cache the import variables hard and it causes the OP's issue. |
Ahhh I see what you mean. I didn't notice that Vue isn't picking up the new values and re-render it. I was only verifying via the That definitely looks like a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may be also missing a removeImportQuery()
here, we can add that in another PR though. You can search the codebase for this function and you'll see we are removing ?import
before transforming and when unwrapping ids to check the module graph. I think these we need better handling in general of these two functions though so we can merge for now this PR.
Description
fixes #15607
I would like to add some tests for it, but I am not sure how to make the imports to have the timestamp query.Theplayground/hmr/soft-invalidate
's imports don't seem to have timestamp query when imported.I'll try to find it my own, but if anyone can show me the way, I'll add some tests as well.Does this issue happen because of how
.vue
parses theimports
?Because in
playground/hmr/soft-invalidate
, changingchild.js
after changingindex.js
triggers soft-invalidation ofindex.js
and it is correctly updates the value offoo
.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).