React Compiler
Oxc has experimental support for the React Compiler, which automatically memoizes React components and hooks.
WARNING
This feature is experimental and under active development. Options and behaviour may change.
Under the hood, Oxc integrates the Rust port of the React Compiler rather than the Babel-based babel-plugin-react-compiler. Oxc vendors and maintains the compiler in-tree, allowing it to operate directly on Oxc's AST.
General Usage
Install the dedicated React transform package:
pnpm add -D oxc-transform-reactimport { transform } from "oxc-transform-react";
// React Compiler is enabled by default with a React 19 target.
const result = await transform("App.jsx", sourceCode);
// Or configure it explicitly.
const configuredResult = await transform("App.jsx", sourceCode, {
reactCompiler: {
// React runtime version target. `'17'` and `'18'` require the
// `react-compiler-runtime` package; `'19'` ships the runtime in `react`.
target: "19", // '17' | '18' | '19'
},
});Pass reactCompiler: false to disable the React Compiler. Omitting the option enables it with the default configuration.
Files whose filename contains node_modules are skipped by default. Providing a reactCompiler.sources allowlist replaces that default filter, so dependencies can be opted in explicitly.
When the React Compiler won't work
The React Compiler requires the original source: it must see JSX before any other transform. Plugins that rewrite JSX first break this. Examples:
@emotion/babel-pluginand othercssprop / JSX pragma transforms.@babel/plugin-transform-react-constant-elementsand-inline-elements, which hoist or inline JSX.
This is why Oxc runs the React Compiler before its own JSX transform.
Code that breaks the Rules of React is also skipped rather than optimized — for example interior mutability, or libraries built on observable mutation such as MobX's observer().
To find that code, Oxlint has experimental React Compiler-powered rules that run the same analysis in lint-only mode and report specific categories of violations.
