Skip to content

Commit e14b825

Browse files
authored
docs: improve configuration example (#14)
1 parent 19122c9 commit e14b825

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ The enabling of the [Preact Refresh](https://github.com/preactjs/prefresh) is di
3434

3535
> In versions below 1.0.0, Rspack did not support preact refresh with `swc-loader`.
3636
>
37-
> Please use `builtin:swc-loader` and enable preact specific transformation with `rspackExperiments.preact: {}`
3837
3938
```js
4039
const PreactRefreshPlugin = require("@rspack/plugin-preact-refresh");
@@ -47,14 +46,17 @@ module.exports = {
4746
rules: [
4847
{
4948
test: /\.jsx$/,
49+
// exclude node_modules to avoid dependencies transformed by `@swc/plugin-prefresh`
50+
exclude: /node_modules/,
5051
use: {
5152
loader: "builtin:swc-loader",
5253
options: {
5354
jsc: {
5455
experimental: {
5556
plugins: [
5657
[
57-
"@swc/plugin-prefresh", // enable prefresh specific transformation
58+
// enable prefresh specific transformation
59+
require.resolve("@swc/plugin-prefresh"),
5860
{
5961
library: ["preact-like-framework"], // the customizable preact name, default is `["preact", "preact/compat", "react"]`
6062
},

0 commit comments

Comments
 (0)