@rsbuild/core 0.2.9 → 0.2.11

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.
@@ -83,7 +83,7 @@ async function init({
83
83
  }
84
84
  }
85
85
  function runCli() {
86
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.9");
86
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.2.11");
87
87
  import_commander.program.command("dev").option("--open", "open the page in browser on startup").option(
88
88
  "--port <port>",
89
89
  "specify a port number for Rsbuild Server to listen"
@@ -34,7 +34,7 @@ function prepareCli() {
34
34
  if (!npm_execpath || npm_execpath.includes("npx-cli.js")) {
35
35
  console.log();
36
36
  }
37
- import_rslog.logger.greet(` ${`Rsbuild v${"0.2.9"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.2.11"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
@@ -373,7 +373,7 @@ function createSocketUrl(resourceQuery) {
373
373
  }
374
374
  function formatURL(param) {
375
375
  var port = param.port, protocol = param.protocol, hostname = param.hostname, pathname = param.pathname;
376
- if (window.URL) {
376
+ if (typeof URL !== "undefined") {
377
377
  var url = new URL("http://localhost");
378
378
  url.port = port;
379
379
  url.hostname = hostname;
@@ -59,7 +59,7 @@ function createContextByConfig(options, bundlerType, config = {}) {
59
59
  const context = {
60
60
  entry: config.source?.entry || getDefaultEntry(rootPath),
61
61
  targets: config.output?.targets || [],
62
- version: "0.2.9",
62
+ version: "0.2.11",
63
63
  rootPath,
64
64
  distPath,
65
65
  cachePath,
@@ -37,12 +37,9 @@ function applyHMREntry(compiler, clientPath) {
37
37
  if (!(0, import_shared.isClientCompiler)(compiler)) {
38
38
  return;
39
39
  }
40
- for (const key in compiler.options.entry) {
41
- compiler.options.entry[key].import = [
42
- clientPath,
43
- ...compiler.options.entry[key].import || []
44
- ];
45
- }
40
+ new compiler.webpack.EntryPlugin(compiler.context, clientPath, {
41
+ name: void 0
42
+ }).apply(compiler);
46
43
  }
47
44
  const getDevMiddleware = (multiCompiler) => (options) => {
48
45
  const { hmrClientPath, callbacks, ...restOptions } = options;
@@ -49,14 +49,10 @@ async function getDefaultSwcConfig(config, rootPath, target) {
49
49
  preserveAllComments: true
50
50
  },
51
51
  isModule: "unknown",
52
- minify: false,
53
- // for loader, we don't need to minify, we do minification using plugin
54
52
  env: {
55
53
  targets: await (0, import_shared.getBrowserslistWithDefault)(rootPath, config, target)
56
54
  },
57
- sourceMaps: Boolean((0, import_shared.getJsSourceMap)(config)),
58
- exclude: [],
59
- inlineSourcesContent: true
55
+ sourceMaps: Boolean((0, import_shared.getJsSourceMap)(config))
60
56
  };
61
57
  }
62
58
  const pluginSwc = () => ({
@@ -21,6 +21,7 @@ __export(transition_exports, {
21
21
  pluginTransition: () => pluginTransition
22
22
  });
23
23
  module.exports = __toCommonJS(transition_exports);
24
+ var import_shared = require("@rsbuild/shared");
24
25
  const pluginTransition = () => ({
25
26
  name: "rsbuild:transition",
26
27
  setup(api) {
@@ -30,6 +31,13 @@ const pluginTransition = () => ({
30
31
  chain.optimization.chunkIds("deterministic");
31
32
  }
32
33
  });
34
+ api.modifyRspackConfig((config) => {
35
+ (0, import_shared.setConfig)(
36
+ config,
37
+ "experiments.rspackFuture.disableApplyEntryLazily",
38
+ true
39
+ );
40
+ });
33
41
  }
34
42
  });
35
43
  // Annotate the CommonJS export names for ESM import in node:
@@ -76,13 +76,13 @@ class CompilerDevMiddleware {
76
76
  this.socketServer.updateStats(stats);
77
77
  }
78
78
  };
79
- const enableHMR = this.devOptions.hmr;
79
+ const injectClient = this.devOptions.hmr || this.devOptions.liveReload;
80
80
  const middleware = devMiddleware({
81
81
  headers: devOptions.headers,
82
82
  publicPath: "/",
83
83
  stats: false,
84
84
  callbacks,
85
- hmrClientPath: enableHMR ? getHMRClientPath(devOptions.client) : void 0,
85
+ hmrClientPath: injectClient ? getHMRClientPath(devOptions.client) : void 0,
86
86
  serverSideRender: true,
87
87
  writeToDisk: devOptions.writeToDisk
88
88
  });
@@ -110,7 +110,7 @@ class SocketServer {
110
110
  this.sockets.splice(idx, 1);
111
111
  }
112
112
  });
113
- if (this.options.hmr) {
113
+ if (this.options.hmr || this.options.liveReload) {
114
114
  this.singleWrite(connection, "hot");
115
115
  }
116
116
  if (this.stats) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Unleash the power of Rspack with the out-of-the-box build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -56,11 +56,11 @@
56
56
  "types.d.ts"
57
57
  ],
58
58
  "dependencies": {
59
- "@rspack/core": "0.4.4",
59
+ "@rspack/core": "0.4.5",
60
60
  "core-js": "~3.32.2",
61
- "html-webpack-plugin": "npm:html-rspack-plugin@5.6.0",
61
+ "html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
62
62
  "postcss": "8.4.31",
63
- "@rsbuild/shared": "0.2.9"
63
+ "@rsbuild/shared": "0.2.11"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/node": "16.x",