Describe the bug
For some specific reason, I had to start the project using Vite in the production environment. At this point, I set config.server.hmr to false in an attempt to avoid unnecessary overhead in the production environment. However, I found that when set to false, the page still creates websocket requests and sends ping messages periodically. However, when the server firewall does not open the default port 24678, the Websocket fails to connect, which triggers a shutdown event and causes the page to auto-refresh over and over again. The Websocket connection seemed useless when config.server.hmr was set to false, so I made some changes to avoid creating a Websocket connection in this case.
Reproduction
https://github.com/MarryDream/vite-hmr-demo
Steps to reproduce
Please deploy to a production server for testing,allow port 11451 on the firewall and access http://ip:11451. But do not allow port 24678
System Info
System:
OS: Linux 3.10 CentOS Linux 7 (Core)
CPU: (2) x64 Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz
Memory: 2.83 GB / 7.64 GB
Container: Yes
Shell: 4.2.46 - /bin/bash
Binaries:
Node: 16.14.0 - /opt/node/v16.14.0/bin/node
npm: 8.3.1 - /opt/node/v16.14.0/bin/npm
pnpm: 8.6.10 - /opt/node/v16.14.0/bin/pnpm
npmPackages:
@vitejs/plugin-vue: ^4.2.3 => 4.2.3
vite: ^4.4.7 => 4.4.7
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
For some specific reason, I had to start the project using Vite in the production environment. At this point, I set
config.server.hmrtofalsein an attempt to avoid unnecessary overhead in the production environment. However, I found that when set to false, the page still creates websocket requests and sends ping messages periodically. However, when the server firewall does not open the default port24678, the Websocket fails to connect, which triggers a shutdown event and causes the page to auto-refresh over and over again. The Websocket connection seemed useless whenconfig.server.hmrwas set tofalse, so I made some changes to avoid creating a Websocket connection in this case.Reproduction
https://github.com/MarryDream/vite-hmr-demo
Steps to reproduce
Please deploy to a production server for testing,allow port
11451on the firewall and accesshttp://ip:11451. But do not allow port24678System Info
System: OS: Linux 3.10 CentOS Linux 7 (Core) CPU: (2) x64 Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz Memory: 2.83 GB / 7.64 GB Container: Yes Shell: 4.2.46 - /bin/bash Binaries: Node: 16.14.0 - /opt/node/v16.14.0/bin/node npm: 8.3.1 - /opt/node/v16.14.0/bin/npm pnpm: 8.6.10 - /opt/node/v16.14.0/bin/pnpm npmPackages: @vitejs/plugin-vue: ^4.2.3 => 4.2.3 vite: ^4.4.7 => 4.4.7Used Package Manager
npm
Logs
No response
Validations