{"id":25046,"library":"bun-plugin-react-compiler","title":"bun-plugin-react-compiler","description":"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.","status":"active","version":"0.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/mnpenner/bun-plugin-react-compiler","tags":["javascript","typescript"],"install":[{"cmd":"npm install bun-plugin-react-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add bun-plugin-react-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add bun-plugin-react-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Babel transformation; must be installed in the consumer project.","package":"@babel/core","optional":false},{"reason":"Peer dependency; the actual React Compiler Babel plugin.","package":"babel-plugin-react-compiler","optional":false}],"imports":[{"note":"Default export is a function that returns a Bun plugin object.","wrong":"import { plugin } from 'bun-plugin-react-compiler'","symbol":"default","correct":"import plugin from 'bun-plugin-react-compiler'"},{"note":"TypeScript type export. Not available at runtime.","wrong":"const { BunPluginReactCompilerOptions } = require('bun-plugin-react-compiler')","symbol":"BunPluginReactCompilerOptions","correct":"import type { BunPluginReactCompilerOptions } from 'bun-plugin-react-compiler'"},{"note":"CommonJS require works, but note the default export is the module itself.","wrong":"const { default: plugin } = require('bun-plugin-react-compiler')","symbol":"require","correct":"const plugin = require('bun-plugin-react-compiler')"}],"quickstart":{"code":"// bunfig.toml (Bun 1.2+) or build script\nimport plugin from 'bun-plugin-react-compiler';\n\nawait Bun.build({\n  entrypoints: ['./src/index.tsx'],\n  outdir: './dist',\n  plugins: [plugin()],\n});","lang":"typescript","description":"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."},"warnings":[{"fix":"Install with: bun add @babel/core babel-plugin-react-compiler","message":"Requires @babel/core and babel-plugin-react-compiler as peer dependencies. Must be installed separately.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Monitor release notes for breaking changes.","message":"The plugin API may change when React Compiler reaches stable release.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Ensure options match babel-plugin-react-compiler's options.","message":"Options passed to plugin() are not validated; wrong options may cause silent failures.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Change to `Bun.build({ plugins: [plugin()] })`.","message":"In v0.3.0, the default export changed from a plugin object to a factory function. Older usage `Bun.build({ plugins: [plugin] })` no longer works.","severity":"breaking","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Call plugin as function: `plugin()` instead of `plugin`.","cause":"Used older import style (direct object) after v0.3.0.","error":"TypeError: plugin is not a function"},{"fix":"Run `bun add @babel/core`.","cause":"Missing peer dependency.","error":"Module not found: @babel/core. Please install it."},{"fix":"Use default import: `import plugin from 'bun-plugin-react-compiler'` then call `plugin()`.","cause":"Using default import incorrectly (e.g., named import).","error":"bun-plugin-react-compiler is not a function or its return value is not a plugin"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}