'Vitejs: WebSocket connection to 'wss://host:port/' failed due to HMR
I deployed a Vue page with Docker and Kubernetes and it is working. However, even though I disabled HMR, Vite keeps refreshing after an error:
WebSocket connection to 'wss://dashboard.default.io:8181/' failed:
[vite] server connection lost. polling for restart...
Dockerfile:
FROM node:16-alpine3.14
WORKDIR /usr/src/app
COPY . .
RUN yarn install
EXPOSE 8181
CMD [ "yarn", "dev","--host", "--port", "8181" ]
yarn dev calls vite command
vite.config.js:
export default defineConfig({
plugins: [vue()],
server: {
hmr: false
}
})
vue.config.js:
module.exports = {
devServer: {
proxy: 'https://backend.default.io'
}
}
package.json:
"dependencies": {
"yarn": "^1.22.18"
}
"devDependencies": {
"@vitejs/plugin-vue": "^1.6.0",
"vite": "^2.5.1",
}
I could not figure out why it is still using HMR since I disabled it. And, how can I fix this? I also tried server.hmr.clientPort: 443 but it also did not work.
It would be sufficient to just disable hmr.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
