Compile all worker executables from source and write them to .zonai/executables/. Also regenerates
.dart_tool/zonai/project_main.dart. Does not create a deployment bundle (use zonai build
for that).
zonai compile [flags]
Flags#
| Flag | Description |
|---|---|
--flavor <name> |
Config flavor to compile with — also selects .env.<name> |
--release | Compile without Dart asserts |
--dart-define KEY=VALUE |
Override or add one compile-time define; repeat per key. Space-separated, not
--dart-define=KEY=VALUE
|
-c, --config <path> | Path to a custom zonai.yaml |
There is no --dart-define-from-file — .env / .env.<flavor>
is loaded
from the project root on its own. See
Environment Variables.
Workers Compiled#
db_config— config workerdb_rules— rules worker (run in-process instead when the project binary is linked)-
db_operations— operations worker (run in-process instead when the project binary is linked) db_extensions— extensions workerdb_rate_limit— rate limit workerdb_crons— crons worker
When to Use Manually#
In dev mode (zonai serve), Zonai watches source files and recompiles workers automatically — manual
compile is rarely needed during development. Use it for:
- Setting up a fresh clone before starting the server
- Verifying compilation succeeds in CI
- Updating compiled binaries after discarding changes that left executables stale
- Preparing workers before running
zonai ruleswithout starting the server
vs. zonai build#
-
zonai compile— workers only, to.zonai/executables/. Use during development. -
zonai build— workers +build/zonai+ migrations, templates and settings underbuild/. Use for deployment.