Skip to content

feat: run the React Compiler natively with oxc-transform-react - #10

Merged
FerMPY merged 1 commit into
mainfrom
react-compiler-oxc
Oct 10, 2026
Merged

FerMPY merged 1 commit into
mainfrom
react-compiler-oxc

Conversation

@FerMPY

@FerMPY FerMPY commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary of Changes

Switches the React Compiler from the Babel plugin to oxc-transform-react, Oxc's native port, enabled with react({ compiler: true }) in vite.config.ts.

  • Removes @babel/core, @rolldown/plugin-babel and babel-plugin-react-compiler, and adds oxc-transform-react@~0.152.0. @vitejs/plugin-react 6.1 only accepts 0.152.x.
  • Dependabot changes:
    • oxc-transform-react is grouped with @vitejs/*, so the two are bumped together.
    • The Babel entries are gone.
    • @types/node major bumps are skipped, so the types keep matching .node-version.
  • README: new "React Compiler" section explaining the setup and how to switch back to Babel. The disclaimer now lists the native compiler as experimental.

Supersedes #9: its @types/node rule is included here, and its @babel/core rule 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-react still 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

  • Same output: the SPA build's JS and CSS are byte-identical to the Babel build on main, down to the hashed filenames. Both have 27 compiler memo markers. The HTML differs only by the prerender timestamp.
  • Checks: a clean pnpm install --frozen-lockfile passes format, lint, typecheck, tests and both builds. React Doctor scores 100/100 and still detects the compiler.
  • Browser: in headless Chrome, the SPA preview renders / and /demo. The SSR server renders /demo with its posts in the HTML.

Checklist

  • I have tested these changes thoroughly
  • pnpm check and pnpm test pass
  • I have updated the documentation (if required)

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit c01ccc9.

@FerMPY
FerMPY merged commit 3de0b9f into main Oct 10, 2026
8 checks passed
@FerMPY
FerMPY deleted the react-compiler-oxc branch October 10, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant