@rspack/plugin-react-refresh 1.0.0-beta.4 → 1.0.0
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 +16 -6
- package/package.json +4 -5
package/README.md
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
|
6
6
|
# @rspack/plugin-react-refresh
|
7
7
|
|
8
|
+
<p>
|
9
|
+
<a href="https://www.npmjs.com/package/@@rspack/plugin-react-refresh?activeTab=readme"><img src="https://img.shields.io/npm/v/@@rspack/plugin-react-refresh?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" /></a>
|
10
|
+
<a href="https://npmcharts.com/compare/@@rspack/plugin-react-refresh?minimal=true"><img src="https://img.shields.io/npm/dm/@@rspack/plugin-react-refresh.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
|
11
|
+
<a href="https://github.com/web-infra-dev/rspack/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" /></a>
|
12
|
+
</p>
|
13
|
+
|
8
14
|
React refresh plugin for [Rspack](https://github.com/web-infra-dev/rspack).
|
9
15
|
|
10
16
|
## Installation
|
@@ -29,8 +35,8 @@ Enabling [React Fast Refresh](https://reactnative.dev/docs/fast-refresh) functio
|
|
29
35
|
- Code transformation can be added through loaders, such as [jsc.transform.react.refresh](https://swc.rs/docs/configuration/compilation#jsctransformreactrefresh) for [swc-loader](https://swc.rs/docs/usage/swc-loader) or the [react-refresh/babel](https://github.com/facebook/react/tree/main/packages/react-refresh) for [babel-loader](https://github.com/babel/babel-loader).
|
30
36
|
|
31
37
|
```js
|
32
|
-
const ReactRefreshPlugin = require(
|
33
|
-
const isDev = process.env.NODE_ENV ===
|
38
|
+
const ReactRefreshPlugin = require("@rspack/plugin-react-refresh");
|
39
|
+
const isDev = process.env.NODE_ENV === "development";
|
34
40
|
|
35
41
|
module.exports = {
|
36
42
|
experiments: {
|
@@ -39,17 +45,17 @@ module.exports = {
|
|
39
45
|
},
|
40
46
|
},
|
41
47
|
// ...
|
42
|
-
mode: isDev ?
|
48
|
+
mode: isDev ? "development" : "production",
|
43
49
|
module: {
|
44
50
|
rules: [
|
45
51
|
{
|
46
52
|
test: /\.jsx$/,
|
47
53
|
use: {
|
48
|
-
loader:
|
54
|
+
loader: "builtin:swc-loader",
|
49
55
|
options: {
|
50
56
|
jsc: {
|
51
57
|
parser: {
|
52
|
-
syntax:
|
58
|
+
syntax: "ecmascript",
|
53
59
|
jsx: true,
|
54
60
|
},
|
55
61
|
transform: {
|
@@ -75,6 +81,10 @@ Compared to the previous approach, this method decouples the React Fast Refresh
|
|
75
81
|
- For usage with `builtin:swc-loader`, you can refer to the example at [examples/react-refresh](https://github.com/rspack-contrib/rspack-examples/tree/main/rspack/react-refresh/rspack.config.js), When using with `swc-loader`, simply replace `builtin:swc-loader` with `swc-loader`.
|
76
82
|
- For usage with `babel-loader`, you can refer to the example at [examples/react-refresh-babel-loader](https://github.com/rspack-contrib/rspack-examples/tree/main/rspack/react-refresh-babel-loader/rspack.config.js)
|
77
83
|
|
84
|
+
## Credits
|
85
|
+
|
86
|
+
Thanks to the [react-refresh-webpack-plugin](https://github.com/pmmmwh/react-refresh-webpack-plugin) created by [@pmmmwh](https://github.com/pmmmwh), which inspires implement this plugin.
|
87
|
+
|
78
88
|
## License
|
79
89
|
|
80
|
-
|
90
|
+
`@rspack/plugin-react-refresh` is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/plugin-react-refresh",
|
3
|
-
"version": "1.0.0
|
3
|
+
"version": "1.0.0",
|
4
4
|
"repository": "https://github.com/rspack-contrib/rspack-plugin-react-refresh",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "React refresh plugin for rspack",
|
@@ -28,9 +28,7 @@
|
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@biomejs/biome": "^1.8.3",
|
31
|
-
"@rspack/core": "1.0.0-beta.
|
32
|
-
"@rspack/test-tools": "1.0.0-beta.3",
|
33
|
-
"@rspack/dev-server": "1.0.0-beta.3",
|
31
|
+
"@rspack/core": "1.0.0-beta.4",
|
34
32
|
"@types/node": "^20.14.13",
|
35
33
|
"@types/jest": "29.5.12",
|
36
34
|
"react-refresh": "^0.14.0",
|
@@ -60,7 +58,8 @@
|
|
60
58
|
},
|
61
59
|
"publishConfig": {
|
62
60
|
"access": "public",
|
63
|
-
"registry": "https://registry.npmjs.org/"
|
61
|
+
"registry": "https://registry.npmjs.org/",
|
62
|
+
"provenance": true
|
64
63
|
},
|
65
64
|
"scripts": {
|
66
65
|
"build": "tsc -b ./tsconfig.build.json",
|