-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Problem
I'm using Vite for frontend development in a special sandbox environment. There's a reverse proxy between the sandbox and users that doesn't support WebSocket connections. Since Vite's HMR relies solely on WebSocket without any fallback mechanism, users cannot see code changes in real-time when WebSocket is unavailable.
Use Case
This feature would be particularly useful for:
Development environments behind reverse proxies that don't support WebSocket
Corporate networks with restrictive firewall policies
Sandboxed or containerized development environments with limited protocol support
Cloud-based IDEs or development platforms
Alternatives Considered
Currently, the only workaround is manual page refresh, which significantly degrades the development experience.
Additional Context
Similar tools like webpack-dev-server offer fallback options (sockjs) for HMR when WebSocket is unavailable. Having this capability in Vite would make it more robust in various network environments.
Suggested solution
Add support for falling back to long polling (or other HTTP-based alternatives) when WebSocket connections fail or are unavailable. This would ensure HMR functionality works in environments where WebSocket is blocked or unsupported.
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.