-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Description
Clear and concise description of the problem
Currently vite will reload the page after the HMR ws link is lost.
In some cases, it may cause frequent page reloads.
In my case,In a hybrid app,we need to use a proxy to avoid domain name restrictions,this will cause the HMR WebSocket connection loss (This is our mistake, and I am trying to solve it),but this cause frequent page reloads.
We comment out location.reload() in vite/dist/client/client.mjs to temporarily solve this problem.
And I found that others have encountered the same problem #5675
Suggested solution
There may be two ways to solve it:
- Reconnect HMR WebSocket connection instead of reloading the page,just like webpack-dev-server.
- Provide
server.hmr.retryconfiguration to manually control whether to retry when the HMR WebSocket connection fails.
For option 2, I will provide a pr(#6090), the preview is like this:

Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
