DocsFrontend
Hot reload
Save a file and the page changes in place, keeping what you were doing.
sluurp serve watches the app folder. Save a file and every open page updates in place, keeping its state: counters keep their count, dialogs stay open, and inputs keep their text. There’s nothing to set up. To use it, serve your app:
sluurp serve --public ./appFeatures include:
- React components swapped with their state kept
- Stylesheets swapped without drawing again
- Markdown pages, layouts and server routes patched into the page
- An overlay with the source line and a link to your editor when something breaks
What updates how
- React components are swapped by Bun’s hot module replacement (React Fast Refresh): the component draws again with its state kept.
- Stylesheets are swapped without drawing again.
- Markdown pages, layouts and server routes are drawn again on the server and patched into the page, without a reload.
- Server code (functions, hooks, jobs) is used as it is now from the next call.
When something breaks
Compile errors and uncaught exceptions show in the dev overlay with the source line, the stack, and a link to open it in your editor. Problems in server code show there too. Problems that aren’t fatal, such as a failed request or a console.error, are counted in a corner badge instead. Fix and save, and the overlay clears itself.
In production
Hot reload is only for development. With --no-hot-reload, or a build made with sluurp build, nothing is watched and no reload script is added to pages.