feat: keep dev server alive during HMR updates

This commit is contained in:
2026-07-13 15:17:49 +05:30
parent cf4c3723c5
commit 577c38a965
62 changed files with 281 additions and 169 deletions
+3 -3
View File
@@ -7,9 +7,9 @@
* { type: "css" } -> the browser hot-swaps the stylesheet (no reload)
* { type: "reload" } -> the browser asks for fresh HTML over the HMR socket
*
* Server-logic changes (pages/api/middleware/realtime) are NOT broadcast here:
* they require a fresh process, so the child exits and the supervisor respawns
* it. The browser then reconnects and performs a soft DOM morph automatically.
* Page/component/API/middleware/realtime changes invalidate their modules and
* broadcast `reload` without closing the server or WebSocket. The browser asks
* the same process for fresh HTML and performs a soft DOM morph.
*/
export type HmrMessage = { type: "css"; version: number } | { type: "reload"; version: number };