Repository navigation
Replies: 4 comments
|
From the Vite config docs, these two switches control different things:
So there isn't a separate third "disable both together" flag because those are already the two knobs. If you're still seeing an overlay after setting So the intended config would be: export default defineConfig({
server: {
hmr: false,
},
})or, if you still want HMR but not the overlay: export default defineConfig({
server: {
hmr: {
overlay: false,
},
},
})If you can share what exact overlay/error is still appearing, that would help confirm whether it's coming from HMR or from a different dev-server path. |
|
Adding to @chrisjcthomas's answer: if you're still seeing an overlay after setting The way the two flags relate, internally:
There's no third "disable both" option because the two above are already the two knobs. What catches people out is that framework plugins ship their own overlays, wired to the same WebSocket but drawn independently. If you still see an overlay after turning Vite's off: // @vitejs/plugin-vue
vue({ devToolsEnabled: false })
// @vitejs/plugin-react
react({ overlay: false })Also worth checking for So the configs you already have are the intended shapes: // disable HMR and overlay together
export default defineConfig({
server: { hmr: false },
})
// keep HMR, just lose the overlay
export default defineConfig({
server: { hmr: { overlay: false } },
})If an overlay still renders after |
|
Yes, it is possible — and The two options control different things, but
So setting both feels redundant because they're not independent. The correct config to disable everything: // vite.config.ts
export default defineConfig({
server: {
hmr: false,
},
});If an overlay still appears after
|
|
I checked this with Vite 8.3.6 in a minimal project. For current Vite, you can disable the WebSocket connection and its error overlay separately: import { defineConfig } from 'vite'
export default defineConfig({
server: {
ws: false,
hmr: { overlay: false },
},
})In the same reproduction, this resolves to One distinction: Vite's HTML 500 error response has a separate overlay-rendering path. If the overlay appears on a failed initial document request, rather than after a WebSocket error, these settings may not cover that case. The requested URL, response status, and Vite version would help identify which path is involved. References: Reproduction and drafting were AI-assisted. |
Uh oh!
There was an error while loading. Please reload this page.
When I set server.hmr to false, the server.hmr.overlay functionality is still enabled;
When I set server.hmr.overlay to false, the server.hmr functionality remains enabled;
It appears impossible to disable both.
All reactions