Bind KV, D1, and R2 in local dev
cloudflare pages
// what it does
Exposes storage bindings to your Functions during local dev by binding name — accessible as `env.CACHE`, `env.DB`, `env.UPLOADS`. Reach for this when a Function reads config from KV, queries D1, or serves files from R2.
// shell
$ wrangler pages dev ./dist --kv CACHE --d1 DB --r2 UPLOADS$ wrangler pages dev ./dist --kv CACHE --persist-to ./.wrangler/state// gotcha
These are simulated with local storage, not your production data; state lives under `.wrangler/state` unless you point `--persist-to` at a stable path to keep it across runs.