vite
vite copied to clipboard
HMR can't be disabled (hmr: false)
Describe the bug
I believe that HMR should be disabled if it is set as hmr: false
and/or vite is running in production
mode.
This is an issue in my case, as we'd like to just run the dev server for a testing site but we get these continual pings (noise)
here is the example site:Example Site
config has this:
const viteServer = await createServer({
mode: "production",
server: {
middlewareMode: true,
hmr: false,
},
appType: "custom",
// other config
})
Note that I've seen others comment about the lack of ability to turn off HMR elsewhere since the 3.0 release: example
Reproduction
https://example.kaption.co
System Info
Fly.io VM
Used Package Manager
pnpm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
The websocket is used for more than HMR as explained at https://github.com/vitejs/vite/issues/6315#issuecomment-1166558944. Disabling it completely would disable the other features too. Maybe we can allow that, but it would be good if you're proxying the websocket server too.
Thanks. As an idea, I think that with transpilation becoming less of a problem Vite could run SSR directly from the DevServer instead of the dual-build (very complicated) SSR method currently recommended.
We ran into a few small issues doing this (like the above) but it almost worked. Feels like a missed opportunity.
I'll close this for now as it's working as intended.