The Preact plugin provides support for Preact, integrating features such as JSX compilation and React aliasing.
You can install the plugin using the following command:
You can register the plugin in the rsbuild.config.ts
file:
After registering the plugin, you can directly develop Preact.
Whether to aliases react
, react-dom
to preact/compat
.
boolean
true
Whether to inject Prefresh for HMR.
boolean
true
>= v1.1.0
Include files to be processed by the @rspack/plugin-preact-refresh plugin. The value is the same as the rule.test
option in Rspack.
/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/
>= v1.1.0
Exclude files from being processed by the @rspack/plugin-preact-refresh plugin. The value is the same as the rule.exclude
option in Rspack.
/[\\/]node_modules[\\/]/
>= v1.1.0