feat: add liveReload option to disable dev WS#23
Conversation
Adds a top-level `liveReload?: boolean` to `MochiServeOptions` that defaults to `development`. Set to `false` to keep the debug bar but skip the `/__mochi_live_reload` WS — the socket is flaky behind the proxy fronting the demo Docker images and dropped connections trigger a `location.reload()` on reconnect. Site + demos entrypoints now read `MOCHI_LIVE_RELOAD=false`, set by the dev-mode Dockerfile so the deployed demos keep the bar but ditch the WS.
Mochi review reportLines of code (non-blank lines) packages/mochi
Unchanged: packages/site
Unchanged: packages/demos
Unchanged: packages/minimal
Unchanged: packages/cli
Unchanged: |
🤖 I have created a release *beep* *boop* --- <details><summary>mochi-framework: 0.3.0</summary> ## [0.3.0](mochi-framework-v0.2.0...mochi-framework-v0.3.0) (2026-05-23) ### Features * add liveReload option to disable dev WS ([#23](#23)) ([616ab7a](616ab7a)) * **mdsvex:** preprocess mochi:hydrate inside markdown files ([#22](#22)) ([bcf08e4](bcf08e4)) ### Bug Fixes * **debug-bar:** show green status dot when liveReload is disabled ([#27](#27)) ([f8896f5](f8896f5)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Stanislav Khromov <stanislav.khromov+github@gmail.com>
Summary
liveReload?: booleanoption onMochiServeOptions. Defaults todevelopment. Set tofalseto keep the debug bar but skip the/__mochi_live_reloadWS and themochi-live-reloadweb component.location.reload()on reconnect, surfacing as unexplained reloads for visitors.MOCHI_LIVE_RELOAD=falseinto the dev-modeDockerfile(which runs bothsiteanddemos) so deployed demos keep the bar but drop the WS. Normalbun run devis unchanged.Test plan
bun run checks(lint + typecheck + tests, all workspaces) passesMODE=development PORT=4444 bun packages/site/src/index.ts→ response hasmochi-live-reload,mochi-dev-toolbar, and__mochi_page_entryas beforeMOCHI_LIVE_RELOAD=false→mochi-dev-toolbarstill present,mochi-live-reloadand__mochi_page_entrygone, and a WS upgrade against/__mochi_live_reloadis rejected with 400