cloudflareDevProxy
Provides Cloudflare Workers bindings to your loaders and actions during local development.Import
Usage
Options
function
Custom function to provide load context to your loaders and actions.Example:
boolean | { path: string }
Enables persistent storage for Cloudflare bindings (KV, DO, R2, D1).Default:
true (persists to .wrangler/state/v3)string
Path to
wrangler.toml configuration file.Default: "./wrangler.toml"boolean
Use
wrangler.json instead of wrangler.toml.Default: falseConfiguration
TypeScript Types
Define your Cloudflare environment types:wrangler.toml
Configure your Cloudflare bindings:Common Patterns
Accessing Bindings in Loaders
Accessing Bindings in Actions
Custom Load Context
Extend the context with custom utilities:Durable Objects
Service Bindings
Production Deployment
In production, Cloudflare provides actual bindings. The dev proxy is only for local development.Build Configuration
Deploy to Cloudflare Pages
Troubleshooting
Bindings Not Available
Ensure:- Plugin is before
reactRouter() wrangler.tomlis properly configured- Types are properly declared
D1 Database Issues
Create local D1 database:KV Persistence
Data persists to.wrangler/state/v3 by default. Clear with: