Skip to content

Watcher

David Reed edited this page Nov 20, 2026 · 1 revision

estrogen --watch keeps estrogen running and re-obfuscates on each change, instead of running it once per build by hand. It is the standalone watcher; the dev-server hot reload each bundler offers is a separate integration (see the end of this page).

When to use it

Run it next to a bundler in watch mode. The bundler rebuilds the dist when you edit a source file; estrogen watches that dist and re-runs its pass on the new output, so the served files stay obfuscated without a manual step between the two.

estrogen --watch dist

It runs one pass up front, then watches until you stop it with Ctrl-C.

How a re-run works

estrogen rewrites files in place and is not idempotent, but it skips a file that already carries its marker. So a re-run only obfuscates the chunks the bundler just wrote fresh, and leaves the ones it already did. estrogen's own writes are marked, so a pass triggered by them finds nothing to do and the watch settles rather than wrapping its output twice.

A burst of writes from one rebuild is coalesced over a short quiet period, so a rebuild that writes many files is one estrogen pass, not one per file. A pass that fails (a parse error caught mid-write, say) is reported and the watch keeps running, so a transient error does not end the session.

Watching a build

estrogen build --watch watches each dist and the from source of every [[vendor]] input, so editing a vendored package re-runs the vendor and obfuscate step too.

estrogen build -c estrogen.toml --watch dist

See Vendoring for the [[vendor]] inputs.

Dev servers

The watcher above is a standalone process. Hot reload through a bundler's own dev server (Vite, Rollup) is a separate plugin integration and is not wired yet; the build plugins run estrogen on build, not in serve. Until it lands, run estrogen --watch alongside the dev server.

The limit is the same in watch mode: this raises the cost of reading the build, it is not secrecy. See Security and limits.

Clone this wiki locally