Skip to content

Bun.Transpiler: default autoImportJSX to true for the automatic runtime - #35557

Open
robobun wants to merge 15 commits into
mainfrom
farm/5470f44d/transpiler-auto-import-jsx-default
Open

Bun.Transpiler: default autoImportJSX to true for the automatic runtime#35557
robobun wants to merge 15 commits into
mainfrom
farm/5470f44d/transpiler-auto-import-jsx-default

scanImports: honor // @jsxRuntime pragma when deciding whether to inj…

3e1b0ea
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 27, 2026 in 17m 7s

Code review found 2 potential issues

Found 3 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/js_parser/parse/parse_entry.rs:484-499 _scan_imports @jsxRuntime pragma mirror drops pair.development
🟡 Nit test/bundler/transpiler/transpiler.test.js:2302-2307 '@jsxRuntime automatic over classic tsconfig' test row is NODE_ENV-dependent

Annotations

Check warning on line 499 in src/js_parser/parse/parse_entry.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

_scan_imports @jsxRuntime pragma mirror drops pair.development

The `RUNTIME_MAP` lookup added in 3e1b0ea4 only reads `.map(|pair| pair.runtime)` and drops `pair.development`, while `prepare_for_visit_pass` (p.rs:2780-2784) — the code this mirrors — also applies `if let Some(dev) = jsx_runtime.development { self.options.jsx.development = dev }`. Two lines later `p.options.jsx.import_source()` branches on `development`, so with e.g. `tsconfig:{jsx:'react-jsx'}` + `'// @jsxRuntime react-jsxdev\n<div/>'`, `.scan()` reports `react/jsx-dev-runtime` while `.scanIm

Check warning on line 2307 in test/bundler/transpiler/transpiler.test.js

See this annotation in the file changed.

@claude claude / Claude Code Review

'@jsxRuntime automatic over classic tsconfig' test row is NODE_ENV-dependent

This row's opts pin neither `define: {"process.env.NODE_ENV": ...}` nor a tsconfig `jsx` value that fixes `development`, so `jsx.development` is derived from ambient `NODE_ENV` — under `NODE_ENV=production` both `.scan()` and `.scanImports()` return `[{path:"react/jsx-runtime"}]` and `toEqual(jsxDevRuntime)` fails. Same fragility class fixed in c9e59569 for the no-arg test, reintroduced here by 3e1b0ea4; either spread `...dev` into this row's opts alongside the tsconfig, or relax the expected pa