Registry / babel-plugin-react-live
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import babelPluginReactLive from 'babel-plugin-react-live'
✗ const babelPluginReactLive = require('babel-plugin-react-live')
CommonJS require works but ESM import is recommended. The package is an ESM/CJS hybrid.
componentName
✓ /* in .babelrc */ { "plugins": [["babel-plugin-react-live", { "componentName": "MyComponent" }]] }
✗ /* wrong: using plugin as string without array */ { "plugins": ["babel-plugin-react-live"] }
Plugin must be configured with options array; componentName is required for matching.
filesToMatch
✓ /* in .babelrc */ { "plugins": [["babel-plugin-react-live", { "filesToMatch": ["Examples.tsx"] }]] }
✗ /* wrong: using glob pattern */ { "filesToMatch": "*.tsx" }
filesToMatch must be an array of exact filenames, not globs.
Configure Babel plugin to transform React Live code examples with TypeScript support.
// Install: npm install --save-dev babel-plugin-react-live
// .babelrc
{
"plugins": [
[
"babel-plugin-react-live",
{
"componentName": "LiveExample",
"filesToMatch": ["Examples.tsx"],
"prettierPath": "./.prettierrc"
}
]
]
}
// Example.tsx
import { LiveProvider, LiveEditor, LivePreview } from 'react-live';
const LiveExample = () => {
const foo = 'bar';
return (
<LiveProvider scope={{ foo }}>
<LiveEditor />
<LivePreview />
</LiveProvider>
);
};
// Transformed: <LiveProvider> children become string literals
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-react-live'
Plugin not installed or missing from package.json devDependencies.
fixRun `npm install --save-dev babel-plugin-react-live`.
SyntaxError: Unexpected token (1:1) while parsing file: Example.tsx
Babel is not configured to parse JSX or TypeScript.
fixAdd `@babel/preset-react` and `@babel/preset-typescript` to your Babel presets.
TypeError: Cannot read properties of undefined (reading 'map')
Plugin options are malformed: `filesToMatch` is not an array.
fixEnsure `filesToMatch` is an array of strings, e.g., `["Examples.tsx"]`.
Audit
Dependencies
@babel/corerequiredpeer dependency for Babel plugin system
react-liverequiredruntime dependency for LiveProvider component