Request queuing during massive HMR module invalidation in Vite
22.5K reputation · 22 Oct 2021, 18:27 UTC
HMR Connection Bottlenecks
Vite uses a WebSocket connection to signal Hot Module Replacement (HMR) updates. When a global dependency or a high-level utility file is modified, the HMR engine invalidates the changed module and its entire dependency chain, triggering a burst of HTTP requests to fetch the updated assets.
In environments restricted to HTTP/1.1, browsers impose a strict limit on concurrent connections to a single domain. This can result in request queuing or timeouts when Vite attempts to fetch hundreds of modules simultaneously during a large-scale update.
While HTTP/2 multiplexing typically mitigates this, certain proxy configurations or legacy environments may still encounter these browser-side connection limits.
- How does Vite prioritize module requests during a massive invalidation event to prevent browser connection pool exhaustion?
- Is there a configurable threshold to trigger a full page reload instead of attempting individual module fetches when the dependency chain exceeds a specific size?