-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
Describe the bug
In remote development environments with cold starts, the first page load sometimes fails because the HMR deps reload message is sent before the WebSocket connection is established. The client never receives it.
This issue is more frequent in v7 than v5.
**Suggested fix (per discussion with @yyx990803):**Buffer HMR messages until WebSocket connection is confirmed established.
Context:
Discussed with Evan in Slack who confirmed the diagnosis and requested an issue to track.
Reproduction
This is a timing-dependent issue in remote/containerized environments with cold starts - difficult to reproduce in standard setups. Discussed with @yyx990803 in Slack who confirmed the diagnosis and requested this issue be filed to track. Happy to provide demo access to our environment.
Steps to reproduce
- Run Vite dev server in a remote/containerized environment
-
- Let it go cold (idle timeout)
-
- Load the page on cold start
-
- First request to deps sometimes fails - the reload message is sent before WebSocket is established
System Info
System:
OS: Linux 4.4 undefined
CPU: (16) x64 unknown
Memory: 31.79 GB / 32.00 GB
Container: Yes
Shell: Unknown
Binaries:
Node: 22.21.1 - /nix/var/nix/profiles/sandbox/bin/node
npm: 10.9.4 - /nix/var/nix/profiles/sandbox/bin/npm
pnpm: 10.25.0 - /nix/var/nix/profiles/sandbox/bin/pnpm
bun: 1.3.2 - /nix/var/nix/profiles/sandbox/bin/bun
Deno: 2.5.6 - /nix/var/nix/profiles/sandbox/bin/denoUsed Package Manager
bun
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.