@rspack/plugin-react-refresh 2.0.0-beta.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -10
- package/package.json +18 -20
package/README.md
CHANGED
|
@@ -37,10 +37,10 @@ import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';
|
|
|
37
37
|
|
|
38
38
|
## Usage
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
To enable [React Fast Refresh](https://reactnative.dev/docs/fast-refresh), you need both runtime injection and source transformation.
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
42
|
+
- This plugin handles runtime injection, including code from [react-refresh](https://www.npmjs.com/package/react-refresh) and the custom runtime it requires.
|
|
43
|
+
- Source transformation should be enabled in your loader, for example with [jsc.transform.react.refresh](https://swc.rs/docs/configuration/compilation#jsctransformreactrefresh) in [swc-loader](https://rspack.rs/guide/features/builtin-swc-loader).
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
46
|
import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';
|
|
@@ -52,17 +52,15 @@ export default {
|
|
|
52
52
|
module: {
|
|
53
53
|
rules: [
|
|
54
54
|
{
|
|
55
|
-
test: /\.jsx$/,
|
|
55
|
+
test: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
56
56
|
use: {
|
|
57
57
|
loader: 'builtin:swc-loader',
|
|
58
58
|
options: {
|
|
59
|
+
detectSyntax: 'auto',
|
|
59
60
|
jsc: {
|
|
60
|
-
parser: {
|
|
61
|
-
syntax: 'ecmascript',
|
|
62
|
-
jsx: true,
|
|
63
|
-
},
|
|
64
61
|
transform: {
|
|
65
62
|
react: {
|
|
63
|
+
runtime: 'automatic',
|
|
66
64
|
development: isDev,
|
|
67
65
|
refresh: isDev,
|
|
68
66
|
},
|
|
@@ -81,8 +79,8 @@ Compared to the previous approach, this method decouples the React Fast Refresh
|
|
|
81
79
|
|
|
82
80
|
## Example
|
|
83
81
|
|
|
84
|
-
- For usage with `builtin:swc-loader`, you can refer to the example at [examples/react-refresh](https://github.com/rstackjs/
|
|
85
|
-
- For usage with `babel-loader`, you can refer to the example at [examples/react-refresh-babel-loader](https://github.com/rstackjs/
|
|
82
|
+
- For usage with `builtin:swc-loader`, you can refer to the example at [examples/react-refresh](https://github.com/rstackjs/rstack-examples/blob/main/rspack/react-refresh/rspack.config.js), When using with `swc-loader`, simply replace `builtin:swc-loader` with `swc-loader`.
|
|
83
|
+
- For usage with `babel-loader`, you can refer to the example at [examples/react-refresh-babel-loader](https://github.com/rstackjs/rstack-examples/blob/main/rspack/react-refresh-babel-loader/rspack.config.js)
|
|
86
84
|
|
|
87
85
|
## Options
|
|
88
86
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/plugin-react-refresh",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"repository": "https://github.com/rstackjs/rspack-plugin-react-refresh",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "React refresh plugin for Rspack",
|
|
@@ -15,16 +15,6 @@
|
|
|
15
15
|
"./react-refresh-entry": "./client/reactRefreshEntry.js",
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "rslib",
|
|
20
|
-
"dev": "rslib -w",
|
|
21
|
-
"lint": "rslint && prettier -c .",
|
|
22
|
-
"lint:write": "rslint --fix && prettier -w .",
|
|
23
|
-
"prepare": "simple-git-hooks && npm run build",
|
|
24
|
-
"test": "rstest",
|
|
25
|
-
"release": "node ./scripts/release.js",
|
|
26
|
-
"bump": "npx bumpp --no-push --no-tag --no-commit"
|
|
27
|
-
},
|
|
28
18
|
"files": [
|
|
29
19
|
"client",
|
|
30
20
|
"dist"
|
|
@@ -33,15 +23,15 @@
|
|
|
33
23
|
"pre-commit": "pnpm run lint:write"
|
|
34
24
|
},
|
|
35
25
|
"devDependencies": {
|
|
36
|
-
"@rslib/core": "^0.
|
|
37
|
-
"@rslint/core": "^0.3
|
|
38
|
-
"@rspack/core": "2.0.
|
|
39
|
-
"@rstest/core": "^0.
|
|
40
|
-
"@types/node": "^24.12.
|
|
41
|
-
"prettier": "^3.8.
|
|
26
|
+
"@rslib/core": "^0.21.5",
|
|
27
|
+
"@rslint/core": "^0.5.3",
|
|
28
|
+
"@rspack/core": "2.0.4",
|
|
29
|
+
"@rstest/core": "^0.10.2",
|
|
30
|
+
"@types/node": "^24.12.4",
|
|
31
|
+
"prettier": "^3.8.3",
|
|
42
32
|
"react-refresh": "^0.18.0",
|
|
43
33
|
"simple-git-hooks": "^2.13.1",
|
|
44
|
-
"typescript": "^6.0.
|
|
34
|
+
"typescript": "^6.0.3"
|
|
45
35
|
},
|
|
46
36
|
"peerDependencies": {
|
|
47
37
|
"@rspack/core": "^2.0.0-0",
|
|
@@ -52,9 +42,17 @@
|
|
|
52
42
|
"optional": true
|
|
53
43
|
}
|
|
54
44
|
},
|
|
55
|
-
"packageManager": "pnpm@10.33.0",
|
|
56
45
|
"publishConfig": {
|
|
57
46
|
"access": "public",
|
|
58
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "rslib",
|
|
51
|
+
"dev": "rslib -w",
|
|
52
|
+
"lint": "rslint && prettier -c .",
|
|
53
|
+
"lint:write": "rslint --fix && prettier -w .",
|
|
54
|
+
"test": "rstest",
|
|
55
|
+
"release": "node ./scripts/release.js",
|
|
56
|
+
"bump": "npx bumpp --no-push --no-tag --no-commit"
|
|
59
57
|
}
|
|
60
|
-
}
|
|
58
|
+
}
|