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-webpackVerified import paths — ran on the pinned version, not inferred.
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.
Order the loaders as: [/* transpiler */, reactCompilerLoader] in the 'use' array.
Use defineReactCompilerLoaderOption({...}) in the loader options.Manually install babel-plugin-react-compiler as a dev dependency if not automatically installed.
Upgrade to webpack 5+ or use rspack.
Run: npm i -D babel-plugin-react-compiler (or yarn/pnpm equivalent).
Use: const { reactCompilerLoader } = require('react-compiler-webpack');Use defineReactCompilerLoaderOption({ runtimeModules: ... }) or pass the options object directly but ensure it matches the schema.