Skip to content

Commit

Permalink
docs: improve configuration example (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Nov 3, 2024
1 parent 19122c9 commit e14b825
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ The enabling of the [Preact Refresh](https://github.com/preactjs/prefresh) is di

> In versions below 1.0.0, Rspack did not support preact refresh with `swc-loader`.
>
> Please use `builtin:swc-loader` and enable preact specific transformation with `rspackExperiments.preact: {}`
```js
const PreactRefreshPlugin = require("@rspack/plugin-preact-refresh");
Expand All @@ -47,14 +46,17 @@ module.exports = {
rules: [
{
test: /\.jsx$/,
// exclude node_modules to avoid dependencies transformed by `@swc/plugin-prefresh`
exclude: /node_modules/,
use: {
loader: "builtin:swc-loader",
options: {
jsc: {
experimental: {
plugins: [
[
"@swc/plugin-prefresh", // enable prefresh specific transformation
// enable prefresh specific transformation
require.resolve("@swc/plugin-prefresh"),
{
library: ["preact-like-framework"], // the customizable preact name, default is `["preact", "preact/compat", "react"]`
},
Expand Down

0 comments on commit e14b825

Please sign in to comment.