Skip to content

Update a Worker's configuration

The worker-config generator toggles opt-in production-readiness settings — Workers observability and Smart Placement — in an existing Worker’s wrangler.jsonc. It targets an existing Worker — scaffold one first with the application generator.

bunx nx g @naxodev/nx-cloudflare:worker-config --project=my-worker --observability

At least one of --observability or --smartPlacement is required.

Option Type Default Description
project string (required) The target Worker project to configure. Defaults to the project inferred from the current working directory.
observability boolean false Enable Workers observability (observability.enabled = true) so logs are retained.
smartPlacement boolean false Enable Smart Placement (placement.mode = "smart") so Cloudflare runs the Worker closest to your backend.
skipFormat boolean false Skip formatting files.
  • JSONC only. The generator edits wrangler.jsonc/wrangler.json while preserving comments and formatting. A Worker on wrangler.toml must be converted first.
  • Passing neither --observability nor --smartPlacement fails loudly — there is nothing for the generator to do.
  • The application generator exposes the same two flags at scaffold time, so worker-config is only needed for Workers that already exist.
{
  "observability": { "enabled": true },
  "placement": { "mode": "smart" }
}