vite dev to a Cloudflare Worker with bindings on env.
1. Point Wrangler at the build
wrangler.jsonc
nodejs_compat is required for getEnv(). Static files from dist/client are served in front of the Worker. The plugin sees Wrangler and sets target: "cloudflare".
2. Bindings
Add whatever Cloudflare products you need. They show up ongetEnv() / c.env during fetch.
wrangler.jsonc
src/env.d.ts
src/routes/index.server.tsx
.dev.vars. Full list of binding kinds: Bindings.
3. Worker entrypoint
fetch is the Hono app. Add cron, queue, or inbound email in src/worker.ts:
src/worker.ts
4. Deploy
/is SSR HTML with/assets/client.js/api/hellois JSON from HonogetEnv().DBis the D1 binding on Worker requestsscheduledruns when Cloudflare fires the cron
vite dev serves HTTP only. Use wrangler dev after a build when you need Miniflare bindings.
A complete D1 + queue + cron app is in examples/cloudflare.