-
-
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
[Vite 3] @vitejs/plugin-vue
breaks HMR when used with vite-plugin-ssr
#9341
Comments
Really looking forward to seeing this resolved! Using |
Not sure if this is related to the same issue as this, but I'm having issues getting HMR working with the react plugin on Vite 3, client-side only. Weirdly enough, if I change the vite config while hosting, HMR starts to work. Are you able to get the same behavior with Vue? I'll open a separate issue if they're not related. |
Also https://twitter.com/youyuxi/status/1552640407057547264. Not sure if these have the same root cause, but something seems wrong with HMR and Vite 3. |
Cause:
vite/packages/plugin-vue/src/handleHotUpdate.ts Lines 36 to 38 in 364aae1
|
We can either change vite detection of main module or add |
Ok I see, but I don't think it's vite-plugin-ssr that should add From vite-plugin-ssr's side the So I'm thinking it's the Vue plugin that can't cope with |
As a user, one of the things I love about It just sounds like the URL patterns in |
@vitejs/plugin-vue
doesn't work@vitejs/plugin-vue
breaks HMR when used with vite-plugin-ssr
I updated the ticket to reflect the latest findings. So it seems like a I think it's probably best if someone familiar with the Vue plugin has a look at this. |
Yeah it seems plugin-vue is failing to find the correct main module as @Demivan said #9341 (comment). const mainModule = modules.find(
(m) => (!/type=/.test(m.url) || /type=script/.test(m.url)) && !m.url.includes('extractExportNames')
) I think there's two ways to fix this but I'm not sure if either of these is a good way.
|
If we want to be agnostic, we should define that any query param that isn't part of the submodule scheme of plugin-vue defines a new module. This sounds like a feature request to me, and it may not be a bad addition. Do all other framework plugins work in this way? About One problem I see with allowing I think one way out is to define that plugin-vue will reload every module with custom queries, and the plugin is expected to narrow it down if it wants to avoid the reload (that I imagine is what vite-plugin-ssr is already doing). We could try to do this change in 3.1. About the implementation, we could first filter any module that has an unrecognized plugin-vue query. |
Just pinging this issue to see if there's been any progress in the last 3 weeks. |
I made a PR solving this: #10794. |
Describe the bug
HMR doesn't work.
== EDIT ==
The root cause seems to be that
@vitejs/plugin-vue
is not respecting ecosystem query parameters. See discussion below.=========
I had a quick look at it: the signal is not being sent to the browser.
Note that the socket message
{"type":"update","updates":[{"type":"js-update","timestamp":1658677022754,"path":"/pages/index.page.client.vue?extractExportNames&lang.vue"
is not enough (it only updates the?extractExportNames
version of the module).The terminal says:
But that's not correct as it should say:
The last line is missing.
Reproduction
https://github.com/brillout/vps-issue-client-only-hmr
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: