Frontend Watch
Guidance for running and troubleshooting the current frontend watch workflow.
Overview
webstir watchbuilds every frontend workspace with the same pipeline aswebstir buildand serves the result from the workspace build directory.spa,ssgandfulldiffer only in what the server does around it.fullproxies/api/*to the supervised backend runtime and renders server views per request.- After a rebuild, the browser updates by what changed:
- CSS swaps in place.
- A page script (anything under
src/frontend/pages/<page>/that compiles to JavaScript): with client-nav, the page is shown again from the new code, where it is. The old page's cleanup runs, the new code'sloadandsetuprun, and<main>is swapped. Scroll, focus, the app shell and anything outside<main>stay. Without client-nav, the page reloads. - Anything else (HTML, the app shell,
app.ts) reloads the page.
- A rebuild that fails a build check (a binding in an SPA page, a browser page rule) keeps serving the last valid page and reports the error.
CLI Commands
- Default frontend loop:
webstir watch --workspace <absolute-path> - Bind a different address or port:
webstir watch --workspace <absolute-path> --host 0.0.0.0 --port 8088 - One-off frontend build:
bunx webstir-frontend build --workspace <absolute-path> - Targeted frontend rebuild:
bunx webstir-frontend rebuild --workspace <absolute-path> --changed-file <absolute-path>
Failure Recovery
- Stop
webstir watch, then start it again. - If dependencies drift, run
bun installin the workspace, then restart the watch loop. - Rebuild once with
bunx webstir-frontend build --workspace <absolute-path>to confirm the frontend package can emit fresh output outside the long-running watch loop. - If the issue is limited to
full, rerun the workspace withwebstir watchand confirm the backend runtime restarts cleanly after a backend edit.
Fallbacks
- Clearing
build/frontendanddist/frontendis safe; the next build or watch cycle will repopulate outputs. - Frontend-only validation can use
bunx webstir-frontend buildorbunx webstir-frontend rebuilddirectly. - Backend-backed validation in an app with a server should still use
webstir watchso the/apiproxy and runtime restarts stay in the loop.