Skip to content

[Bug]: Panic in side_effect_detector: "jsx should be transpiled" when @content-collections/vite plugin triggers SSR dep scan #8216

@austinm911

Description

@austinm911

Human Note

AI assisted generating this issue over the course of debugging. Did not confirm the analysis section below.

Potential Repro

The app I have this issue is quite large and not exactly able to get it to repro exactly, but I think this may give some insights.

https://github.com/austinm911/rolldown-jsx-cloudflare-repro

Rolldown Version

1.0.0-rc.3 (via Vite 8.0.0-beta.13)

Description

Rolldown panics with internal error: entered unreachable code: jsx should be transpiled in side_effect_detector/mod.rs:659 during dev server startup when the @content-collections/vite plugin is active.

The content-collections plugin itself generates pure JS data files (no JSX). The panic occurs when Rolldown's SSR dep optimizer scans .tsx route files that import from the content-collections alias. The side-effect detector encounters JSX AST nodes before any transform plugin has run and hits an unreachable!() assertion.

Reproduction

  1. Vite 8.0.0-beta.13 with TanStack Start (React)
  2. Add @content-collections/vite plugin (order doesn't matter — tested first and last)
  3. Have .tsx files that import { ... } from 'content-collections'
  4. Start dev server → panic

Removing the content-collections plugin eliminates the panic. The plugin only:

  • Registers an alias ("content-collections" → .content-collections/generated/)
  • Adds optimizeDeps.exclude: ["content-collections"] (client-side only)
  • Runs a builder in configureServer/buildStart

Plugin source: https://github.com/sdorra/content-collections/blob/main/packages/vite/src/index.ts

Stack Trace

thread 'tokio-runtime-worker' panicked at crates/rolldown/src/ast_scanner/side_effect_detector/mod.rs:659:9:
internal error: entered unreachable code: jsx should be transpiled
stack backtrace:
   0: _napi_register_module_v1
   1: _napi_register_module_v1
   ...
  30: __pthread_cond_wait

Analysis

The unreachable!() at side_effect_detector/mod.rs:659 assumes JSX has been transpiled before the AST scanner runs. During SSR dep optimization, Rolldown scans the full import graph including .tsx files. Since transform plugins (e.g., @vitejs/plugin-react) haven't processed these files yet at scan time, the side-effect detector encounters raw JSX nodes and panics.

The fix should replace the unreachable!() with a safe fallback — either:

  • Parse JSX natively in the side-effect detector, or
  • Conservatively assume side-effectful when JSX is encountered

Workaround

Disable the @content-collections/vite plugin.

Environment

  • Rolldown: 1.0.0-rc.3
  • Vite: 8.0.0-beta.13
  • OS: macOS arm64
  • Runtime: Bun 1.3.3
  • Framework: TanStack Start (React)
  • React plugin: @vitejs/plugin-react with babel-plugin-react-compiler

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions