Targ Apps Docs
Chroma

Live reload

How the browser reloads when you save a file during chroma dev, and the exact flags, variables, and settings that turn it on or off.

During chroma dev in a browser, the dev server watches your project and reloads the whole tab when a source file changes. This is a full page reload, not hot module replacement: the tab restarts, so state held in signals is lost and the WASM engine and module graph stay consistent.

Chroma Desktop develop mode never reloads. The window keeps running while you edit; reopen or refresh it yourself to see changes.

When reload is on

How you run itLive reload
chroma dev in the browser (--no-desktop, or any app without dev.desktop: true)On
chroma dev with dev.desktop: true (Chroma Desktop opens)Off
engine run by hand without flagsOff
chroma build outputOff, no client is injected

Turn it on or off

This table is the single reference for every switch. The same names appear in the CLI reference and Server.

SwitchWhereEffect
dev.hotReloadchroma.jsonfalse disables reload for the project. When set, it wins over the variable and the flags below. The key keeps this name.
chroma dev --no-reloadCLI (alias --no-hot-reload)Disable for this session.
chroma dev --reloadCLI (alias --hot-reload)Enable for this session.
CHROMA_DEV_RELOAD=0 or 1Environment0 disables, 1 enables. Desktop develop mode sets 0 for you.
CHROMA_DEV_RELOAD_DEBOUNCE_MSEnvironmentWait after a change before reloading. Default 300.
engine --reloadDev server (aliases --watch, --hot-reload)Enable for this process.
engine --no-reloadDev server (alias --no-watch)Disable. Beats --reload and CHROMA_DEV_RELOAD=1.

For the standalone engine, reload is on only if you pass --reload (or set CHROMA_DEV_RELOAD=1) and nothing disables it. CHROMA_DEV_RELOAD=0 always wins.

What the server watches

Under the app root, skipping hidden folders and node_modules, dist, target, pkg, build, coverage:

  • chroma.json and chroma-fs.json
  • Everything under assets/
  • Any .chr file
  • Files in src/ and plugins/ with a web extension (chr, js, mjs, html, css, json, svg, wasm, png, jpg, jpeg, webp, ico)
  • Any .html file, including the root index.html

The watcher polls file modification times every 200 ms, then waits the debounce interval and confirms the change before reloading.

How it works

  1. The dev server injects <script src="/__chroma/dev-reload.js"></script> into every HTML response.
  2. That script opens a WebSocket to /__chroma/dev/reload?clientKind=browser.
  3. When a watched file changes, the server sends {"type":"reload"} and the page calls location.reload(). If the socket drops, the script reconnects every 800 ms.

A page URL containing chroma_no_reload=1 skips the client script. A WebSocket request with clientKind=desktop is rejected with 403.

Try it

cd my-app
chroma dev --no-desktop
# Open http://localhost:4173 (or your dev.port) and view source:
# it includes /__chroma/dev-reload.js.
# Edit src/App.chr and save: the tab reloads within about a second.

To confirm it is off with Desktop, run chroma dev in an app with dev.desktop: true, edit a .chr file, and notice the window does not reload.

On this page