Documentation / zerotal / dev / DEV_RELOAD_CLIENT
Variable: DEV_RELOAD_CLIENT
constDEV_RELOAD_CLIENT:string
Defined in: packages/core/src/dev/reloadClient.ts:23
The browser half of dev live-reload: an inline script injected into dev HTML
responses. It connects to /__dev/ws and reloads the tab on two signals.
• reload — the orchestrator finished a rebuild triggered by a frontend
change and pushed it straight through the worker.
• version:<token> — sent by the worker the moment a socket opens. A
backend change also rebuilds assets, but it restarts the worker, and the
restart kills every socket: a reload pushed at that instant reaches
nobody, because the tab only reconnects a second later. So the tab
remembers the build token it first saw and reloads when a reconnect
reports a different one. That is how a rebuild riding along with a
server restart still reaches the browser.
Reconnecting on close (rather than on error) is what keeps a server restart from wedging the page without spinning up a reload loop.
Exported as a string because it is injected inline: DevReloadMiddleware
rewrites HTML responses with it for every view layer, and Inertia bakes it
into its cached template so streamed pages need no body rewrite.