From b50e5c5c86e2c3fd597468222bd422bfc8ea2c26 Mon Sep 17 00:00:00 2001 From: Brenley Dueck Date: Thu, 23 Jul 2026 05:47:22 -0500 Subject: [PATCH 1/2] fix: send server environments their reload signal on hot update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Returning [] from hotUpdate for non-client environments suppresses the full-reload messages that would race client HMR, but it also suppresses the only signal environment-runner based servers (e.g. nitro's dev worker) have for re-evaluating modules: with the modules array emptied, Vite's dead-end propagation never fires the environment-level full-reload, so SSR keeps serving stale modules until the dev server is restarted — and hydration mismatches against the freshly HMR-updated client. Keep the suppression, but send the reload on the environment's own hot channel first. For runner-based environments that channel reaches the runner; for the default ssr environment it is a no-op; it is never the browser websocket, so client HMR stays free of full-reload races. --- src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d4f409c..5269173 100644 --- a/src/index.ts +++ b/src/index.ts @@ -626,12 +626,21 @@ export default function solidPlugin(options: Partial = {}): Plugin[] { } as typeof hot.send; }, - hotUpdate() { + hotUpdate({ modules }) { // solid-refresh only injects HMR boundaries into client modules, so // non-client environments have no accept handlers. Without this, Vite // would see no boundaries and send full-reload messages that race with // client-side HMR updates. if (this.environment.name !== 'client') { + // Returning [] also suppresses the signal environment-runner based + // servers (e.g. nitro's dev worker) rely on to re-evaluate modules, + // leaving SSR stale until a manual restart. Send the reload on this + // environment's own channel — for runner-based environments that is + // the runner, for the default ssr environment a no-op, and never the + // browser websocket, so client HMR stays free of full-reload races. + if (modules.length > 0) { + this.environment.hot.send({ type: 'full-reload' }); + } return []; } }, From b8470ecaafa51580e290f2dc297f3c319993b15c Mon Sep 17 00:00:00 2001 From: Brenley Dueck Date: Mon, 27 Jul 2026 20:40:29 -0500 Subject: [PATCH 2/2] chore: add changeset for server environment reload --- .changeset/server-environments-reload.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/server-environments-reload.md diff --git a/.changeset/server-environments-reload.md b/.changeset/server-environments-reload.md new file mode 100644 index 0000000..4b60bc4 --- /dev/null +++ b/.changeset/server-environments-reload.md @@ -0,0 +1,7 @@ +--- +'vite-plugin-solid': patch +--- + +Send non-client server environments their own full-reload signal during hot +updates. Environment-runner based servers now re-evaluate changed modules +instead of serving stale SSR output, while client HMR remains unaffected.