Repository navigation
feat: run the React Compiler natively with oxc-transform-react - #10
Merged
Merged
Conversation
Replaces the Babel plugin (@rolldown/plugin-babel, @babel/core and
babel-plugin-react-compiler) with Oxc's native port of the React Compiler,
enabled with `react({ compiler: true })`. The SPA build's JS and CSS are
byte-identical to the Babel build, and the transform is much faster.
Dependabot now updates oxc-transform-react together with
@vitejs/plugin-react (which pins its 0.x range), and skips @types/node
major bumps so the types match .node-version. The README explains how to
switch back to Babel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Switches the React Compiler from the Babel plugin to
oxc-transform-react, Oxc's native port, enabled withreact({ compiler: true })invite.config.ts.@babel/core,@rolldown/plugin-babelandbabel-plugin-react-compiler, and addsoxc-transform-react@~0.152.0.@vitejs/plugin-react6.1 only accepts 0.152.x.oxc-transform-reactis grouped with@vitejs/*, so the two are bumped together.@types/nodemajor bumps are skipped, so the types keep matching.node-version.Supersedes #9: its
@types/noderule is included here, and its@babel/corerule isn't needed anymore.Detailed Explanation
The React team merged a Rust port of the React Compiler into
facebook/react. Oxc vendored it and made it conform to the Babel version: identical output across more than 100k files from 100+ repos, and over 10x faster.@vitejs/plugin-reactstill labels the integration experimental, so the README documents the way back.Babel is still installed transitively, because TanStack Start's router plugin uses it to split route files and the shadcn CLI uses it too. It's just no longer part of this project's own setup.
Verification
main, down to the hashed filenames. Both have 27 compiler memo markers. The HTML differs only by the prerender timestamp.pnpm install --frozen-lockfilepasses format, lint, typecheck, tests and both builds. React Doctor scores 100/100 and still detects the compiler./and/demo. The SSR server renders/demowith its posts in the HTML.Checklist
pnpm checkandpnpm testpass🤖 Generated with Claude Code