@rsbuild/webpack 0.4.13 → 0.4.14

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.
@@ -50,10 +50,10 @@ const build = async (initOptions, { mode = "production", watch, compiler: custom
50
50
  isFirstCompile = false;
51
51
  await p;
52
52
  };
53
- try {
54
- compiler.hooks.done.tapPromise("rsbuild:done", onDone);
55
- } catch {
53
+ if ((0, import_shared.isMultiCompiler)(compiler)) {
56
54
  compiler.hooks.done.tap("rsbuild:done", onDone);
55
+ } else {
56
+ compiler.hooks.done.tapPromise("rsbuild:done", onDone);
57
57
  }
58
58
  if (watch) {
59
59
  compiler.watch({}, (err) => {
@@ -46,8 +46,7 @@ async function createCompiler({
46
46
  });
47
47
  const { default: webpack } = await Promise.resolve().then(() => __toESM(require("webpack")));
48
48
  const compiler = webpackConfigs.length === 1 ? webpack(webpackConfigs[0]) : webpack(webpackConfigs);
49
- let isFirstCompile = true;
50
- compiler.hooks.done.tap("rsbuild:done", async (stats) => {
49
+ const done = async (stats) => {
51
50
  const { message, level } = (0, import_provider.formatStats)(stats);
52
51
  if (level === "error") {
53
52
  import_shared.logger.error(message);
@@ -62,7 +61,13 @@ async function createCompiler({
62
61
  });
63
62
  }
64
63
  isFirstCompile = false;
65
- });
64
+ };
65
+ let isFirstCompile = true;
66
+ if ((0, import_shared.isMultiCompiler)(compiler)) {
67
+ compiler.hooks.done.tap("rsbuild:done", done);
68
+ } else {
69
+ compiler.hooks.done.tapPromise("rsbuild:done", done);
70
+ }
66
71
  await context.hooks.onAfterCreateCompiler.call({
67
72
  compiler
68
73
  });
@@ -41,7 +41,7 @@ const applyHMREntry = (compiler, clientPath) => {
41
41
  }).apply(compiler2);
42
42
  }
43
43
  };
44
- if (compiler.compilers) {
44
+ if ((0, import_shared.isMultiCompiler)(compiler)) {
45
45
  compiler.compilers.forEach((target) => {
46
46
  applyEntry(clientPath, target);
47
47
  });
@@ -50,7 +50,7 @@ const applyHMREntry = (compiler, clientPath) => {
50
50
  }
51
51
  };
52
52
  const setupHooks = (compiler, hookCallbacks) => {
53
- if (compiler.compilers) {
53
+ if ((0, import_shared.isMultiCompiler)(compiler)) {
54
54
  compiler.compilers.forEach(
55
55
  (compiler2) => (0, import_shared.setupServerHooks)(compiler2, hookCallbacks)
56
56
  );
package/dist/shared.js CHANGED
@@ -35,8 +35,7 @@ module.exports = __toCommonJS(shared_exports);
35
35
  var import_node_fs = __toESM(require("node:fs"));
36
36
  var import_node_path = require("node:path");
37
37
  var import_shared = require("@rsbuild/shared");
38
- var import_shared2 = require("@rsbuild/shared");
39
- const applyDefaultPlugins = (plugins) => (0, import_shared2.awaitableGetter)([
38
+ const applyDefaultPlugins = (plugins) => (0, import_shared.awaitableGetter)([
40
39
  plugins.basic?.(),
41
40
  plugins.entry?.(),
42
41
  plugins.cache?.(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/webpack",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "homepage": "https://rsbuild.dev",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,13 +35,13 @@
35
35
  "terser-webpack-plugin": "5.3.10",
36
36
  "tsconfig-paths-webpack-plugin": "4.1.0",
37
37
  "webpack": "^5.89.0",
38
- "@rsbuild/core": "0.4.13",
39
- "@rsbuild/shared": "0.4.13"
38
+ "@rsbuild/core": "0.4.14",
39
+ "@rsbuild/shared": "0.4.14"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "16.x",
43
43
  "typescript": "^5.4.2",
44
- "@scripts/test-helper": "0.4.13"
44
+ "@scripts/test-helper": "0.4.14"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",