-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(hmr): duplicated modules because of query params mismatch (fixes #2255) #9773
Conversation
packages/vite/src/client/client.ts
Outdated
@@ -431,7 +436,9 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) { | |||
/* @vite-ignore */ | |||
base + | |||
path.slice(1) + | |||
`?import&t=${timestamp}${query ? `&${query}` : ''}` | |||
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${ |
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 noticed this is not correct.
dep
is always acceptedPath
, not path
.
I considered about including |
@sapphi-red lets mark the new field as |
Description
This PR fixes #2255 by only appending
?import
when it should be.I passed
explicitImportRequired
property to do the check on server side, not to duplicateisExplicitImportRequired
function toclient/client.ts
.fixes #2255
Additional context
?import
is used to differentiateimport './foo.png'
andfetch('./foo.png')
. The ideal way is to useAccept
header but unfortunately requests byimport
usesAccept: */*
and cannot be used.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).