Dev and build
This page explains what ow dev and ow build actually do, so you can reason
about artifacts, environment variables, and hot reload.
ow dev
ow dev orchestrates three moving parts:
Vite dev server ──► http://localhost:5173
│
│ OW_DEV_SERVER_URL
▼
Native kernel (owear) ── loads your frontend, injects window.ow
▲
│ OW_APP_MAIN (optional)
Node sidecar (app/main.js, compiled from app/main.ts)
Steps:
- Vite starts with
--port 5173 --strictPort. The CLI waits until it responds before continuing. - Native modules — if
native/exists,owear-build-nativecompiles every.cppinto.owear/modules/<name>.owm. - Main process —
app/main.tsis compiled with esbuild to.owear/main.js. Dependencies stay external (they are innode_modules). - Workers —
app/workers/**are compiled to.owear/workers/. - Kernel — launched with the environment below.
Environment passed to the kernel:
| Variable | Value |
|---|---|
OW_APP_NAME |
name from package.json |
OW_DEV_SERVER_URL |
http://localhost:5173/ |
OW_APP_MAIN |
.owear/main.js (if a main entry exists) |
OW_START_URL |
dev URL (only when there is no main entry) |
OW_APP_WORKERS |
.owear/workers (if workers exist) |
OW_MODULES_DIR |
stock modules path + .owear/modules |
The stock modules directory matters: the kernel does not recurse into subdirectories, so the CLI passes each
build/<preset>/api/<name>/directory joined withpath.delimiter.
Press Ctrl+C or close the last window: the CLI kills the kernel and Vite.
ow build (the bundle)
ow build
Produces dist/:
dist/— Vite production build of the frontend;dist/main.js— the main process, with@owear/corebundled in (a single-file app must not depend onnode_modulesat runtime);dist/workers/— compiled workers;dist/modules/— compiled.owmmodules.
The CLI prints the exact command to run the bundle against the kernel:
OW_ASSETS_DIR=dist OW_APP_MAIN=dist/main.js OW_MODULES_DIR="…" ./owear
ow build app
Packages the app into a distributable artifact. See
Packaging. Formats: binary (default), deb,
appimage, msi.
ow build app --format binary
ow build app --format deb
ow build app --format appimage
ow build app --format msi # Windows
ow build installer / uninstaller
Builds a separate installer (or uninstaller) app that embeds your app as a payload. See Installers.
Why the main process is compiled
Node does not run TypeScript until v22.6 (and only with a flag until v23.6). The
CLI uses esbuild (which ships with Vite) to compile app/main.ts to JavaScript so
that any Node on the user's machine can run it. This is what makes the
"resolve Node at runtime" model in Native addons
work.
Next steps
- Your first app — a complete tutorial.
- Packaging and Installers.