Registry / devops / react-compiler-webpack

react-compiler-webpack

JSON →
library1.0.0jsnpmunverified

A webpack and rspack loader plugin that integrates the official React Compiler (React Forget) into your build pipeline. Version 1.0.0 provides a thin wrapper around babel-plugin-react-compiler, allowing automatic memoization of React components and hooks. It supports both webpack and rspack configurations, ships with TypeScript types, and requires babel-plugin-react-compiler as a peer dependency. Key differentiator: it is the only dedicated webpack loader for React Compiler, offering a simple setup with defineReactCompilerLoaderOption helper for type-safe options. Release cadence is stable with active maintenance on GitHub.

npm install react-compiler-webpack
INSTALL
IMPORT
SIG · REACT-COMPILER-WEB
R
react-compiler-webpack
devopsjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

reactCompilerLoader
const { reactCompilerLoader } = require('react-compiler-webpack');
const reactCompilerLoader = require('react-compiler-webpack');
Default export is an object, not the loader itself. Must destructure reactCompilerLoader.
defineReactCompilerLoaderOption
const { defineReactCompilerLoaderOption } = require('react-compiler-webpack');
import defineReactCompilerLoaderOption from 'react-compiler-webpack';
This is a named export, not default. Also available via ESM: import { defineReactCompilerLoaderOption } from 'react-compiler-webpack';
reactCompilerLoader
import { reactCompilerLoader } from 'react-compiler-webpack';
ESM import works fine. TypeScript types are included.

Configures webpack to use react-compiler-webpack loader for automatic memoization of React components. Requires a JSX transpiler (e.g., babel-loader) placed before this loader in the use array.

// webpack.config.js const { reactCompilerLoader, defineReactCompilerLoaderOption } = require('react-compiler-webpack'); module.exports = { module: { rules: [ { test: /\.[mc]?[jt]sx?$/i, exclude: /node_modules/, use: [ // Your existing JSX transpiler (e.g., babel-loader, swc-loader) // { loader: 'babel-loader' }, { loader: reactCompilerLoader, options: defineReactCompilerLoaderOption({ // React Compiler options // e.g., runtimeModules: { 'react': 'import React from "react"' } }) } ] } ] } }; // Then build with webpack as normal
Debug
Known issues
gotchaLoader must be placed AFTER your JSX transpiler (e.g., babel-loader, swc-loader) in the loaders array, not before.
fix
Order the loaders as: [/* transpiler */, reactCompilerLoader] in the 'use' array.
affects: >=0.0.0
deprecatedreact-compiler-webpack does not support configuration via ReactCompilerConfig in tsconfig.json or babel config; options must be passed via loader options.
fix
Use defineReactCompilerLoaderOption({...}) in the loader options.
affects: >=0.0.0
gotchababel-plugin-react-compiler must be installed as a peer dependency; auto-install may fail with npm <7 or yarn classic.
fix
Manually install babel-plugin-react-compiler as a dev dependency if not automatically installed.
affects: >=0.0.0
gotchaNot compatible with webpack 4; requires webpack 5 or later (or rspack).
fix
Upgrade to webpack 5+ or use rspack.
affects: >=0.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'babel-plugin-react-compiler'
Missing peer dependency babel-plugin-react-compiler.
fix
Run: npm i -D babel-plugin-react-compiler (or yarn/pnpm equivalent).
TypeError: reactCompilerLoader is not a function
Default import instead of named import for reactCompilerLoader.
fix
Use: const { reactCompilerLoader } = require('react-compiler-webpack');
Option 'runtimeModules' is not allowed
Passing React Compiler options incorrectly; they must be wrapped in defineReactCompilerLoaderOption() or passed as a plain object.
fix
Use defineReactCompilerLoaderOption({ runtimeModules: ... }) or pass the options object directly but ensure it matches the schema.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
babel-plugin-react-compilerrequiredPeer dependency; react-compiler-webpack delegates compilation to babel-plugin-react-compiler
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
3
Resources
react-compiler-webpack — npm install react-compiler-webpack · libregistry