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.
booleantrueWhether to inject Prefresh for HMR.
booleantrue>= v1.1.0Include 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.0Exclude 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