Preact plugin
The Preact plugin provides support for Preact, integrating features such as JSX compilation and React aliasing.
Quick start
Install plugin
Run the following command:
Tip
@rsbuild/plugin-preact v2 no longer supports Rsbuild 1.x. If your project uses Rsbuild 1.x, install @rsbuild/plugin-preact@1 instead.
Register plugin
Register the plugin in Rsbuild config:
rsbuild.config.ts
After registration, you can develop Preact directly.
Options
reactAliasesEnabled
Whether to aliases react, react-dom to preact/compat.
- Type:
boolean - Default:
true - Example: Disable aliases.
prefreshEnabled
Whether to inject Prefresh for HMR.
- Type:
boolean - Default:
true - Version:
>= v1.1.0 - Example: Disable Prefresh.
preactRefreshOptions
Set the options for @rspack/plugin-preact-refresh. The value is passed to the Rspack plugin, and preactPath is automatically configured by Rsbuild.
- Type:
- Default:
The default value is the same as @rspack/plugin-preact-refresh:
- Example:

