I have a server side rendered production mode Vite application. My issue is that: routinely the webpage will reload and the console will display [vite] connecting.... I traced this back to the hot module reload portion of vite's codebase. However, I do not want hmr on for production, but it still seems to be on regardless of me setting the two settings below to false:
In my vite.config.js file I have:
...
export default defineConfig({
server: {
hmr: false,
},
Also in my NodeJS server.js file I have:
const vite = await createViteServer({
server: { middlewareMode: 'ssr', hmr: false },
})
How can I turn off Vite's hmr?
Just modify the server property in vite.config.ts:
server: {
hmr: false
}
(This seems to be the simplest way.)
Credit: https://stackoverflow.com/a/77129725/152711
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With