Skip to content

shadcn / Can't find variable: import_jsx_runtime / react-server build && react-server start #266

Description

@aheissenberger

Describe the bug

I click in the browser on the hamburger menu which uses the shadcn <DropdownMenu>component and than get the Error: Can't find variable: import_jsx_runtime. Problem only exists when built and served. Problem does not exist in dev mode.

Changes after installing base template with pnpx @lazarv/create-react-server (defaults):

  1. change @React-router to latest version
  2. add shadcn with pnpm dlx shadcn@latest init
  3. set "rsc": true, in shadcn components.json (will add "use client"; header to all components on install)
  4. add dropdown-menu with pnpm dlx shadcn@latest add
  5. add component dropdown-menu to App.tsx
  6. change to "vite": "npm:rolldown-vite@^7.1.20" in packages.json
    The error seems to be related to a radix package - see browser screenshot Browser Log dist.DxXz_LOD.mjs:1:1692

Burger Menu: http://localhost:3000/
Image

Error after klick on burger menu: http://localhost:3000/
Image

Error in Browser Log

Image

Reproduction

https://github.com/aheissenberger/rs-bug-004

Steps to reproduce

  1. clone repository
  2. install packages: pnpm i
  3. build and start app: pnpm build && pnpm start
  4. open app in browser (Chrome)
  5. click on burger menu in the center

System Info

System:
    OS: macOS 15.7.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 667.00 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.10.0 - /opt/homebrew/bin/node
    npm: 11.6.0 - /opt/homebrew/bin/npm
    pnpm: 10.20.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.123
    Safari: 26.0.1
  npmPackages:
    @lazarv/react-server: 0.0.0-experimental-f78674e-20251024-15fb4a92 => 0.0.0-experimental-f78674e-20251024-15fb4a92 
    @lazarv/react-server-adapter-vercel: 0.0.0-experimental-138ef89-20241217-08cf78b6 => 0.0.0-experimental-138ef89-20241217-08cf78b6 
    rolldown-vite:  7.1.20

Used Package Manager

pnpm

Logs

Click to expand: Error im Browser
hook.js:608 ReferenceError: import_jsx_runtime is not defined
    at dist.DxXz_LOD.mjs:1:1692
    at ys (react.C4q7D8pD.mjs:8:50098)
    at il (react.C4q7D8pD.mjs:8:70141)
    at Ml (react.C4q7D8pD.mjs:8:85931)
    at Df (react.C4q7D8pD.mjs:8:133480)
    at wf (react.C4q7D8pD.mjs:8:132561)
    at Cf (react.C4q7D8pD.mjs:8:132399)
    at uf (react.C4q7D8pD.mjs:8:128958)
    at lp (react.C4q7D8pD.mjs:8:145316)
    at ip (react.C4q7D8pD.mjs:8:143569)
overrideMethod @ hook.js:608
Gc @ react.C4q7D8pD.mjs:8
Jc @ react.C4q7D8pD.mjs:8
Zc.o.componentDidCatch.e.callback @ react.C4q7D8pD.mjs:8
Wo @ react.C4q7D8pD.mjs:8
Go @ react.C4q7D8pD.mjs:8
Ul @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
Xu @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
Xu @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
Xu @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
Xu @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
Xu @ react.C4q7D8pD.mjs:8
Pu @ react.C4q7D8pD.mjs:8
If @ react.C4q7D8pD.mjs:8
Mf @ react.C4q7D8pD.mjs:8
df @ react.C4q7D8pD.mjs:8
uf @ react.C4q7D8pD.mjs:8
lp @ react.C4q7D8pD.mjs:8
ip @ react.C4q7D8pD.mjs:8
op @ react.C4q7D8pD.mjs:8
(anonymous) @ react.C4q7D8pD.mjs:8
github.svg:1  Failed to load resource: net::ERR_CONNECTION_REFUSED
react-server.svg:1  Failed to load resource: net::ERR_CONNECTION_REFUSED
hook.js:608 ReferenceError: import_jsx_runtime is not defined
    at dist.DxXz_LOD.mjs:1:1692
    at ys (react.C4q7D8pD.mjs:8:50098)
    at il (react.C4q7D8pD.mjs:8:70141)
    at Ml (react.C4q7D8pD.mjs:8:85931)
    at Df (react.C4q7D8pD.mjs:8:133480)
    at wf (react.C4q7D8pD.mjs:8:132561)
    at Cf (react.C4q7D8pD.mjs:8:132399)
    at uf (react.C4q7D8pD.mjs:8:128958)
    at lp (react.C4q7D8pD.mjs:8:145316)
    at ip (react.C4q7D8pD.mjs:8:143569)
overrideMethod @ hook.js:608

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions