fix(transformer): don't discard output on non-fatal React Compiler errors#23587
fix(transformer): don't discard output on non-fatal React Compiler errors#23587Boshen wants to merge 1 commit into
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d8dfe7c78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merging this PR will not alter performance
Comparing Footnotes
|
2d8dfe7 to
eec3f27
Compare
68a6d8b to
20375f9
Compare
eec3f27 to
4e94f85
Compare
4e94f85 to
44450d5
Compare
44450d5 to
f19c41a
Compare
…rors With the default `panicThreshold: 'none'` the React Compiler skips a function it can't compile and still succeeds, but oxc treated any error-severity diagnostic as fatal and emitted nothing for the whole file — unlike babel-plugin-react-compiler, which emits the rest of the module. Surface a `fatal` flag from `oxc_react_compiler` (set only for `CompileResult::Error`, which `panicThreshold` escalates to) and only abort the transform when it is set. Otherwise keep the compiled (or untouched original) program, run the rest of the pipeline, and demote the React Compiler's diagnostics to warnings so code is still emitted. The `react-compiler` lint rule continues to report them at full severity through its own path.
f19c41a to
a4697f8
Compare

Problem
With the default
panicThreshold: 'none'the React Compiler skips a function it can't compile (a Rules-of-Hooks violation, an unsupported syntax bail-out, …) and still succeeds, leaving a valid program. But oxc treated any error-severity diagnostic as fatal and emitted nothing for the whole file — unlikebabel-plugin-react-compiler, which emits the rest of the module.Fix
Surface a
fatalflag fromoxc_react_compiler(set only forCompileResult::Error, which the compiler returns only whenpanicThresholdescalates an error to fatal). The transformer now:fatalis set (e.g.panicThreshold: 'critical_errors' | 'all_errors');The
react-compilerlint rule is unaffected — it reads diagnostics through its ownlint()path and still filters onSeverity::Error.How it was found / impact
By diffing oxc's React Compiler output against
babel-plugin-react-compileracross theoxc-ecosystem-cirepos (~42k.tsx/.jsxfiles):The remaining 11 are genuine
panicThreshold-fatal compiles, which correctly still abort.🤖 Developed with Claude Code (AI-assisted).