cf_wrangler_dev
cf_wrangler_dev starts wrangler dev for one or more cf_worker_config values. The first configuration is the primary Worker that receives incoming requests. Additional configurations run as auxiliary Workers and can be reached through service bindings.
xx writes strict JSON configurations to a private temporary directory, passes that directory through --cwd, repeats --config in the given order, and removes the directory after Wrangler exits. Local D1, KV, and R2 data persists under .wrangler/state in the first configuration's dir; pass --persist-to to choose another location. args cannot set --cwd, --config, or -c because xx manages those flags. Relative values for Wrangler's known path flags are resolved from the project root before Wrangler changes directories.
Arguments
| Argument | Required | Description |
|---|---|---|
configs | Yes | Non-empty list of Worker configurations. The first is the primary Worker. |
args | No | Additional string arguments passed to wrangler dev, such as ("--port", "8788"). |
deps | No | Dependencies activated before running Wrangler. Use these to provide Wrangler, credentials, an account ID, and generated Worker files. |
Example
This example expects package.json to list "wrangler": "4.123.0" in devDependencies.
load("@cloudflare@1", "cf_worker_config", "cf_wrangler_dev")
load("@[email protected]", "npm_install")
load("@os@1", "env_prepend")
wrangler = npm_install() + env_prepend("PATH", "node_modules/.bin")
api = cf_worker_config({
"name": "api",
"main": "src/api.ts",
"compatibility_date": "2026-08-18",
}, dir="workers")
jobs = cf_worker_config({
"name": "jobs",
"main": "src/jobs.ts",
"compatibility_date": "2026-08-18",
}, dir="workers")
cf_wrangler_dev([api, jobs], args=("--port", "8788"), deps=[wrangler])