mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #195] Plan for bindings #46
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jokull on GitHub (Feb 28, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/195
Is there a roadmap for making bindings available (D1, R2, etc.) in RSC? On my blog I'm doing direct drizzle stuff in RSC.
@southpolesteve commented on GitHub (Mar 2, 2026):
Thanks for filing this! Good news: bindings should already work in server components today via the
cloudflare:workersmodule import.We just verified that the build pipeline handles this correctly. The
@cloudflare/vite-pluginruns the RSC environment in workerd, wherecloudflare:workersis a native module. vinext doesn't interfere with the resolution. The import gets properly externalized in the production build so workerd resolves it at runtime.No custom worker entry needed, no special configuration. Just
import { env } from "cloudflare:workers"in any server component and your D1, R2, KV, AI, etc. bindings should be available.The existing examples all predate this pattern (they use the older
fetch(request, env)approach with custom worker entries), which is probably why it wasn't obvious that this works. We'll update the examples to show the modern pattern.Are you seeing different behavior? If
cloudflare:workersisn't resolving for you, let us know what error you're hitting and we can dig in.@jokull commented on GitHub (Mar 2, 2026):
Just didn't know about cloudflare:workers env shim! Thank you. An example will point us all in the right direction.