You can refer to the current document to manually add configurations for Preact.
Rspack leverages SWC transformer for JSX/TSX.
Add builtin:swc-loader
loader to support jsx
and tsx
:
Refer to Builtin swc-loader for detailed configurations.
Refer to examples/preact for the full example.
To enable Preact Refresh, the following steps are required:
@rspack/plugin-preact-refresh
plugin to inject runtime codeFirst you need to install the dependencies:
The enabling of the Preact Refresh is divided into two parts: code injection and code transformation
@prefresh/core
and @prefresh/utils
, which has been integrated in the @rspack/plugin-preact-refresh pluginbuiltin:swc-loader
jsc.transform.react.refresh
to support common react transformationrspackExperiments.preact
to support the specific transformation of preactbabel-loader
and add official babel plugin of prefresh.Refer to examples/preact-refresh for the full example.