React Compiler Check
raw JSON → 0.1.11 verified Fri May 01 auth: no javascript
A CLI tool that scans React projects for code patterns incompatible with React Compiler. Version 0.1.11, pre-1.0 with monthly releases. Detects legacy patterns (string refs, Legacy Context), impure renders (setTimeout, fetch in render), improper hook usage (hooks in loops/conditions), direct state mutations, and dynamic objects. Provides actionable suggestions. Lightweight, zero-config, integrates with ESLint via optional plugin. Unlike React Compiler's built-in checks, this is a standalone diagnostics tool for existing codebases.
Common errors
error Error: Cannot find module 'react-compiler-check' ↓
cause Package not installed globally or locally, or not in node_modules.
fix
Install locally: npm install react-compiler-check --save-dev. Or use npx: npx react-compiler-check
error TypeError: check.run is not a function ↓
cause Using default import in ESM when only named export exists.
fix
Use import { run } from 'react-compiler-check'
error SyntaxError: Unexpected token 'export' ↓
cause Running in a CJS environment without transpilation.
fix
Use require('react-compiler-check') or configure your bundler to handle ESM.
Warnings
gotcha Tool scans .ts and .tsx files but requires TypeScript installed separately if your project uses TypeScript. ↓
fix Install typescript as a dev dependency: npm install --save-dev typescript
gotcha CLI may not detect issues in files outside the given directory; does not follow imports or resolve monorepos. ↓
fix Run tool on each package directory separately or use a glob pattern if supported (currently not).
gotcha Tool reports false positives for patterns that React Compiler actually supports (e.g., certain useEffect dependencies). Always verify with the actual compiler. ↓
fix Cross-check with React Compiler's own validation. Contribute to the tool to refine rules.
breaking Breaking changes in 0.2.0: output format changed from plain text to JSON; API renamed from analyze to run. ↓
fix Update scripts parsing CLI output or switch to programmatic API with run().
Install
npm install react-compiler-check yarn add react-compiler-check pnpm add react-compiler-check Imports
- default (CLI) wrong
react-compiler-checkcorrectnpx react-compiler-check ./src - require (CJS)
const check = require('react-compiler-check') - ESM import wrong
import reactCompilerCheck from 'react-compiler-check'correctimport { run } from 'react-compiler-check'
Quickstart
npx react-compiler-check ./src