Registry / web-framework / bun-plugin-react-compiler

bun-plugin-react-compiler

JSON →
library0.3.2jsnpmunverified

Bun plugin for the React Compiler (formerly React Forget). Version 0.3.2, maintained actively. Integrates the React Compiler (Babel plugin) directly into Bun's bundler, allowing compilation of React components during bundling without additional Babel setup. Key differentiator: no need to run Babel separately when using Bun; handles both .js and .tsx files. Ships TypeScript types. Requires @babel/core and babel-plugin-react-compiler as peer dependencies.

npm install bun-plugin-react-compiler
INSTALL
IMPORT
SIG · BUN-PLUGIN-REACT-C
B
bun-plugin-react-compiler
web-frameworkjavascriptv0.3.2
harness data pending
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
✓ import plugin from 'bun-plugin-react-compiler'
✗ import { plugin } from 'bun-plugin-react-compiler'
Default export is a function that returns a Bun plugin object.
BunPluginReactCompilerOptions
✓ import type { BunPluginReactCompilerOptions } from 'bun-plugin-react-compiler'
✗ const { BunPluginReactCompilerOptions } = require('bun-plugin-react-compiler')
TypeScript type export. Not available at runtime.
require
✓ const plugin = require('bun-plugin-react-compiler')
✗ const { default: plugin } = require('bun-plugin-react-compiler')
CommonJS require works, but note the default export is the module itself.

Shows how to use the default export as a Bun plugin in a build script. Default export is a factory function that returns a Bun.Plugin object.

// bunfig.toml (Bun 1.2+) or build script import plugin from 'bun-plugin-react-compiler'; await Bun.build({ entrypoints: ['./src/index.tsx'], outdir: './dist', plugins: [plugin()], });
Debug
Known issues
gotchaRequires @babel/core and babel-plugin-react-compiler as peer dependencies. Must be installed separately.
fix
Install with: bun add @babel/core babel-plugin-react-compiler
affects: >=0.0.0
deprecatedThe plugin API may change when React Compiler reaches stable release.
fix
Monitor release notes for breaking changes.
affects: >=0.3.0
gotchaOptions passed to plugin() are not validated; wrong options may cause silent failures.
fix
Ensure options match babel-plugin-react-compiler's options.
affects: >=0.0.0
breakingIn v0.3.0, the default export changed from a plugin object to a factory function. Older usage `Bun.build({ plugins: [plugin] })` no longer works.
fix
Change to `Bun.build({ plugins: [plugin()] })`.
affects: <0.3.0
Errors
Common errors & fixes
TypeError: plugin is not a function
Used older import style (direct object) after v0.3.0.
fix
Call plugin as function: `plugin()` instead of `plugin`.
Module not found: @babel/core. Please install it.
Missing peer dependency.
fix
Run `bun add @babel/core`.
bun-plugin-react-compiler is not a function or its return value is not a plugin
Using default import incorrectly (e.g., named import).
fix
Use default import: `import plugin from 'bun-plugin-react-compiler'` then call `plugin()`.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required for Babel transformation; must be installed in the consumer project.
babel-plugin-react-compilerrequiredPeer dependency; the actual React Compiler Babel plugin.
Agent activity
11 hits · last 30 days
node
9
OpenAI (training)
1
Resources
bun-plugin-react-compiler — npm install bun-plugin-react-compiler · libregistry