Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default export
✓ import reactCompilerMarker from 'react-compiler-marker'
✗ const reactCompilerMarker = require('react-compiler-marker')
Package is ESM-only. CommonJS require will fail unless using a dynamic import.
run
✓ import { run } from 'react-compiler-marker'
✗ const { run } = require('react-compiler-marker')
run is a named export. CommonJS require will fail with ESM.
ReportFormat type
✓ import type { ReportFormat } from 'react-compiler-marker'
TypeScript type import; use import type for type-only imports.
Shows how to programmatically run react-compiler-marker as a Node.js API, with options for directory, format, exclusions, and babel plugin path.
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));
react-compiler-marker --version
Debug
Known issues
breakingv0.1.0 is initial release; API may change in future minor versions.fixPin to exact version in package.json if stability is required.
affects: >=0.1.0
gotchaRequires 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.fixEnsure babel-plugin-react-compiler is installed. Use --babel-plugin-path option to specify exact path if auto-detection fails.
affects: >=0.1.0
gotchaThe 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.fixUse || true or conditional logic to handle exit code 1 appropriately.
affects: >=0.1.0
deprecatedNo deprecated features yet; package is at v0.1.0 initial release.
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-react-compiler'
The required peer dependency is not installed in the target project or cannot be resolved.
fixInstall the plugin: npm install babel-plugin-react-compiler --save-dev or provide the path via --babel-plugin-path.
Error: No files found matching extensions .js,.jsx,.ts,.tsx,.mjs,.cjs in directory '.'
The directory does not contain any files with the default extensions, or the directory path is incorrect.
fixVerify the directory path and adjust --include-extensions to match your project's file extensions.
SyntaxError: Cannot use import statement outside a module
Attempting to import the package using CommonJS require() which is not supported (ESM-only).
fixUse dynamic import: const reactCompilerMarker = await import('react-compiler-marker'); or ensure your project is configured as ESM. Audit
Dependencies
babel-plugin-react-compilerrequiredRequired peer dependency for the CLI to work; it scans files using the Babel plugin to detect compiled and failed components.