> local dev
Everything for the edit-run loop before you ship: booting your Worker or Pages app in the local workerd runtime, wiring up simulated KV/D1/R2 bindings, firing cron triggers on demand, and choosing between local and production data. In wrangler v4, `wrangler dev` runs fully local by default — reach for `--remote` only when you need real edge resources. These are the commands you run dozens of times a day.
// local dev
9 commands$ wrangler dev$ wrangler dev --remote$ wrangler dev --test-scheduled$ wrangler dev -c ./wrangler.staging.jsonc$ wrangler pages dev ./dist --kv CACHE --d1 DB --r2 BUCKET --binding API_URL=http://localhost:3000 --live-reload$ wrangler d1 execute <name> --local --file=./schema.sql$ wrangler d1 migrations apply <name> --local$ wrangler dev --persist-to ./.wrangler-state$ wrangler deploy --dry-run --outdir ./dist// faq
Does wrangler dev use my production data?
No. In v4, wrangler dev runs locally in the workerd runtime with simulated bindings backed by .wrangler/state — nothing touches production. Add --remote to run on Cloudflare's edge against real KV, R2, D1, and Hyperdrive resources.
Why did my local D1 data disappear between runs?
Local state defaults to the .wrangler/state directory, and it's easy to end up with separate stores if commands use different --persist-to paths. Point wrangler dev and wrangler d1 execute at the same --persist-to (or both at the default) so they share one local store.
How do I run dev for a specific environment or one of several config files?
Use --env <name> to activate an [env.<name>] block and its matching .dev.vars.<name>, or -c ./path/wrangler.jsonc to load a completely different config file. They aren't interchangeable: -c swaps the whole file, --env only selects a sub-block within one.