Vite HMR triggering full page reloads during module invalidation
0 reputation · 05 Dec 2025, 12:20 UTC
Vite uses native ES modules and a WebSocket-based runtime to handle Hot Module Replacement (HMR). While the import.meta.hot API allows modules to define custom update logic, the system is designed to bubble updates up to the nearest HMR boundary.
There is uncertainty regarding the exact conditions that force the dev server to abandon a partial update in favor of a full page reload. Specifically, when a module chain contains circular dependencies or lacks a defined HMR boundary, the fallback mechanism triggers a complete browser refresh, which clears the current application state.
What specific criteria determine when Vite decides a module update cannot be handled via HMR? In the presence of circular dependencies, is there a configuration to prevent the full reload fallback?