Skip to content

bundledDev: true replaces jsxDEV factory with (void 0) for JSX in conditional expressions #21843

@0rvar

Description

@0rvar

Describe the bug

With experimental: { bundledDev: true }, JSX expressions on the right side of && lose their jsxDEV factory binding. The bundled output emits (void 0)(...) instead of (0, import_jsx_dev_runtime.jsxDEV)(...), causing TypeError: (void 0) is not a function at runtime.

The outer JSX call resolves correctly — only the nested JSX after && (and ?:) is affected. The import_jsx_dev_runtime binding is in scope and used successfully one line above.

// works:
(0, import_jsx_dev_runtime.jsxDEV)("div", {
  // broken — should be (0, import_jsx_dev_runtime.jsxDEV):
  children: show && (void 0)("span", { children: "hello" }, ...)
})

Reproduction

https://github.com/0rvar/vite-bundled-dev-void0-repro

Steps to reproduce

yarn install
yarn dev
# In another terminal:
node check-void0.mjs
# or just visit http://localhost:5173/ and observe the error in console

System Info

System:
  OS: macOS 15.7.3
  CPU: (10) arm64 Apple M1 Pro
  Memory: 75.61 MB / 32.00 GB
  Shell: 4.0.2 - /Users/orvar/.nix-profile/bin/fish
Binaries:
  Node: 22.21.1 - /private/var/folders/dn/_tz2y9sx0sx00ynd_92qpt300000gn/T/xfs-098afd11/node
  Yarn: 4.5.1 - /private/var/folders/dn/_tz2y9sx0sx00ynd_92qpt300000gn/T/xfs-098afd11/yarn
  npm: 10.8.2 - /nix/store/2kjd2hdrq0jwvp1bsprkc1l43igxklza-nodejs-20.19.6/bin/npm
  pnpm: 10.25.0 - /nix/store/nxr10pnynlzqsfcnc4h4zv2724a8i7v8-pnpm-10.25.0/bin/pnpm
  bun: 1.3.8 - /Users/orvar/.nix-profile/bin/bun
Browsers:
  Brave Browser: 135.1.77.101
  Chrome: 145.0.7632.117
  Chrome Canary: 147.0.7717.0
  Edge: 131.0.2903.51
  Firefox: 142.0
  Safari: 18.6
npmPackages:
  @vitejs/plugin-react: 6.0.0 => 6.0.0
  vite: 8.0.0 => 8.0.0

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarity: highp2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions