oxc-plugin-react-compiler
raw JSON → 0.2.0 verified Fri May 01 auth: no javascript
Rust port of babel-plugin-react-compiler for OXC/Vite v8. Current stable version: 0.2.0. Release cadence: frequent (10+ versions in 3 months). Key differentiators: 100% conformance parity with upstream React Compiler, Rust performance, source map generation. Not official React or OXC project, community-driven. Experimental, but aims for exact behavior alignment.
Common errors
error Error: [vite] The requested module 'oxc-plugin-react-compiler' does not provide an export named 'reactCompilerOxc' ↓
cause Mis-imported from wrong path or older version that had different export.
fix
Ensure you use import { reactCompilerOxc } from 'oxc-plugin-react-compiler' and have v0.2.0+ installed.
error Error: Cannot find module 'oxc-plugin-react-compiler/eslint' ↓
cause Using CommonJS require() on an ESM-only module.
fix
Use import statement and ensure project uses ESM (type: 'module' in package.json) or use bundler.
error Error: [plugin:oxc-react-compiler] Failed to resolve plugin options ↓
cause Invalid options object passed to reactCompilerOxc().
fix
Check documentation for valid options: compilationMode ('infer'|'annotation'|'all'), panicThreshold ('none'|'all'), target ('18'|'19'), sources (string[]|function).
Warnings
gotcha ESLint plugin must use subpath import 'oxc-plugin-react-compiler/eslint', not package root. ↓
fix Use import from 'oxc-plugin-react-compiler/eslint' for ESLint/Oxlint.
breaking Requires Vite 8.0 or later; will fail on earlier versions. ↓
fix Update Vite to >=8.0.0.
breaking ESM-only; CommonJS require() will throw. ↓
fix Use import syntax instead of require().
gotcha package root exports Vite plugin, not the linter. Mis-importing leads to undefined. ↓
fix Use 'oxc-plugin-react-compiler/eslint' for ESLint/Oxlint.
deprecated v0.1.0 and earlier did not support ESM-only; check your bundler. ↓
fix Upgrade to v0.2.0+ for ESM support or use bundler that handles mixed modules.
Install
npm install oxc-plugin-react-compiler yarn add oxc-plugin-react-compiler pnpm add oxc-plugin-react-compiler Imports
- reactCompilerOxc wrong
import { reactCompilerOxc } from 'oxc-plugin-react-compiler/react'correctimport { reactCompilerOxc } from 'oxc-plugin-react-compiler' - default (ESLint) wrong
import reactCompiler from 'oxc-plugin-react-compiler'correctimport reactCompiler from 'oxc-plugin-react-compiler/eslint' - reactCompiler.configs.recommended wrong
require('oxc-plugin-react-compiler/eslint').configs.recommendedcorrectimport reactCompiler from 'oxc-plugin-react-compiler/eslint'
Quickstart
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { reactCompilerOxc } from 'oxc-plugin-react-compiler';
export default defineConfig({
plugins: [
reactCompilerOxc({
compilationMode: 'infer',
panicThreshold: 'none',
target: '19',
}),
react(),
],
});