@lovable.dev/vite-plugin-hmr-gate
v1.8.2
Published
Vite plugin that gates HMR updates behind an HTTP flush signal
Maintainers
Readme
@lovable.dev/vite-plugin-hmr-gate
Vite dev-server plugin that waits to send HMR updates until another process says a write batch is complete.
Source lives in
npm-packages/lovable-vite-tanstack/src/hmr-gate; this package is a self-contained standalone build of it for plain-Vite projects.
What It Does
- Buffers selected file watcher events instead of sending immediate browser updates.
- Reports pending files at
GET /__hmr_gate. - Flushes queued changes from
POST /__hmr_flush, either as a full reload or as granular file events.
Options
fullReload (default true) picks the flush behaviour: a browser full reload,
or granular file events that let Vite send per-module updates and reload only
when an edit has no HMR boundary.
When the option is unset, the plugin reads LOVABLE_HMR_FULL_RELOAD from the
environment; only the exact value false selects granular mode. An explicit
option always wins.
Why It Exists
Lovable often writes multiple files as one logical update. Gating HMR keeps the preview from refreshing midway through that batch.
