react-compiler-marker
raw JSON → 0.1.0 verified Fri May 01 auth: no javascript
CLI tool (v0.1.0) to scan React projects and report which components are optimized by the React Compiler and which have issues. Supports multiple output formats — plain text, self-contained HTML report with filtering and tree view, and JSON for CI pipelines. Requires babel-plugin-react-compiler to be installed. Differentiates from other tools by focusing specifically on React Compiler integration with explicit failure reporting and exit code 1 on failures, making it suitable for CI enforcement. Released under MIT.
Common errors
error Error: Cannot find module 'babel-plugin-react-compiler' ↓
cause The required peer dependency is not installed in the target project or cannot be resolved.
fix
Install the plugin: npm install babel-plugin-react-compiler --save-dev or provide the path via --babel-plugin-path.
error Error: No files found matching extensions .js,.jsx,.ts,.tsx,.mjs,.cjs in directory '.' ↓
cause The directory does not contain any files with the default extensions, or the directory path is incorrect.
fix
Verify the directory path and adjust --include-extensions to match your project's file extensions.
error SyntaxError: Cannot use import statement outside a module ↓
cause Attempting to import the package using CommonJS require() which is not supported (ESM-only).
fix
Use dynamic import: const reactCompilerMarker = await import('react-compiler-marker'); or ensure your project is configured as ESM.
Warnings
breaking v0.1.0 is initial release; API may change in future minor versions. ↓
fix Pin to exact version in package.json if stability is required.
gotcha Requires babel-plugin-react-compiler to be installed as a dependency in the target project. Auto-detection may fail if plugin path is symlinked or not in default node_modules. ↓
fix Ensure babel-plugin-react-compiler is installed. Use --babel-plugin-path option to specify exact path if auto-detection fails.
gotcha The CLI exits with code 1 when compilation failures are found. In CI pipelines, ensure this exit code is handled correctly to avoid false positives if failures are expected. ↓
fix Use || true or conditional logic to handle exit code 1 appropriately.
deprecated No deprecated features yet; package is at v0.1.0 initial release.
Install
npm install react-compiler-marker yarn add react-compiler-marker pnpm add react-compiler-marker Imports
- default export wrong
const reactCompilerMarker = require('react-compiler-marker')correctimport reactCompilerMarker from 'react-compiler-marker' - run wrong
const { run } = require('react-compiler-marker')correctimport { run } from 'react-compiler-marker' - ReportFormat type
import type { ReportFormat } from 'react-compiler-marker'
Quickstart
import { run } from 'react-compiler-marker';
const result = await run({
directory: '.',
format: 'json',
excludeDirs: ['node_modules', 'dist'],
includeExtensions: ['.tsx', '.ts'],
babelPluginPath: process.env.BABEL_PLUGIN_PATH ?? undefined
});
console.log(JSON.stringify(result, null, 2));