mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #100] shadcn fail : React.createContext is not a function #27
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#27
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 @liuhuapiaoyuan on GitHub (Feb 26, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/100
https://github.com/liuhuapiaoyuan/vinext-shadcn-bug
@beniaminrychter commented on GitHub (Feb 26, 2026):
I have the same issue. I use:
Log
@sanwalsulehri commented on GitHub (Feb 26, 2026):
can i work on this
@sanwalsulehri commented on GitHub (Feb 26, 2026):
can i work on this
@southpolesteve commented on GitHub (Mar 1, 2026):
Investigated this. The standard ShadCN setup with individual
@radix-ui/*packages works correctly with vinext, including:"use client") using@radix-ui/react-slot"use client") using@radix-ui/react-dialog"use client") using@radix-ui/react-dropdown-menuThe reason it works: the individual
@radix-ui/*packages that use client-only React APIs (createContext, hooks, etc.) properly declare"use client"in their published dist files. The RSC plugin intercepts these and creates client reference proxies, so the actual code never executes in the RSC environment. Packages like@radix-ui/react-slotthat don't use client-only APIs work fine as server components.Root cause of the reported error: The reproduction repo uses the unified
radix-uipackage (v1.x), which barrels all Radix primitives into a single entry point. That barrel file does not have"use client"at the top, so when it gets loaded in the RSC environment, it pulls in modules like@radix-ui/react-directionthat callReact.createContext()at the top level. In the RSC environment,reactresolves toreact-server, which doesn't exportcreateContext.Workaround: Use the individual
@radix-ui/*packages (which is what ShadCN's CLI generates by default) instead of the unifiedradix-uipackage.Added ecosystem coverage for ShadCN/Radix UI to the test suite so we don't regress on this.
@liuhuapiaoyuan commented on GitHub (Mar 2, 2026):
👏👏👏👏👏👏👏👏👏👏👏👏👏👏
Perfect fix, I changed the repository name vinext-shadcn-starter