@rspack/dev-server 0.3.4 → 0.3.5

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.
Files changed (2) hide show
  1. package/dist/server.js +21 -4
  2. package/package.json +4 -4
package/dist/server.js CHANGED
@@ -117,12 +117,29 @@ class RspackDevServer extends webpack_dev_server_1.default {
117
117
  this.logger.warn("Hot Module Replacement (HMR) is enabled for the production build. \n" +
118
118
  "Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration.");
119
119
  }
120
+ // enable hot by default
120
121
  (_a = (_e = compiler.options).devServer) !== null && _a !== void 0 ? _a : (_e.devServer = {});
121
122
  compiler.options.devServer.hot = true;
122
- (_b = (_f = compiler.options.builtins).react) !== null && _b !== void 0 ? _b : (_f.react = {});
123
- (_c = (_g = compiler.options.builtins.react).refresh) !== null && _c !== void 0 ? _c : (_g.refresh = true);
124
- (_d = (_h = compiler.options.builtins.react).development) !== null && _d !== void 0 ? _d : (_h.development = true);
125
- new plugin_react_refresh_1.default().apply(compiler);
123
+ if (!compiler.options.experiments.rspackFuture.disableTransformByDefault) {
124
+ (_b = (_f = compiler.options.builtins).react) !== null && _b !== void 0 ? _b : (_f.react = {});
125
+ // enable react.development by default
126
+ (_c = (_g = compiler.options.builtins.react).development) !== null && _c !== void 0 ? _c : (_g.development = true);
127
+ // enable react.refresh by default
128
+ (_d = (_h = compiler.options.builtins.react).refresh) !== null && _d !== void 0 ? _d : (_h.refresh = true);
129
+ if (compiler.options.builtins.react.refresh) {
130
+ const runtimePaths = plugin_react_refresh_1.default.deprecated_runtimePaths;
131
+ new compiler.webpack.EntryPlugin(compiler.context, runtimePaths[0], {
132
+ name: undefined
133
+ }).apply(compiler);
134
+ new compiler.webpack.ProvidePlugin({
135
+ $ReactRefreshRuntime$: runtimePaths[1]
136
+ }).apply(compiler);
137
+ compiler.options.module.rules.unshift({
138
+ include: runtimePaths,
139
+ type: "js"
140
+ });
141
+ }
142
+ }
126
143
  }
127
144
  else if (compiler.options.builtins.react.refresh) {
128
145
  if (mode === "production") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/dev-server",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "license": "MIT",
5
5
  "description": "Development server for rspack",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "@types/ws": "8.5.3",
29
29
  "fs-extra": "11.1.0",
30
30
  "puppeteer": "19.4.0",
31
- "@rspack/core": "0.3.4"
31
+ "@rspack/core": "0.3.5"
32
32
  },
33
33
  "dependencies": {
34
34
  "chokidar": "3.5.3",
@@ -40,8 +40,8 @@
40
40
  "webpack-dev-middleware": "6.0.2",
41
41
  "webpack-dev-server": "4.13.1",
42
42
  "ws": "8.8.1",
43
- "@rspack/dev-server": "0.3.4",
44
- "@rspack/plugin-react-refresh": "0.3.4"
43
+ "@rspack/dev-server": "0.3.5",
44
+ "@rspack/plugin-react-refresh": "0.3.5"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@rspack/core": "*"