@rsbuild/webpack 0.4.11 → 0.4.13

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/core/build.js +24 -16
  2. package/package.json +6 -6
@@ -41,9 +41,20 @@ const build = async (initOptions, { mode = "production", watch, compiler: custom
41
41
  });
42
42
  bundlerConfigs = webpackConfigs;
43
43
  }
44
+ let isFirstCompile = true;
44
45
  await context.hooks.onBeforeBuild.call({
45
46
  bundlerConfigs
46
47
  });
48
+ const onDone = async (stats) => {
49
+ const p = context.hooks.onAfterBuild.call({ isFirstCompile, stats });
50
+ isFirstCompile = false;
51
+ await p;
52
+ };
53
+ try {
54
+ compiler.hooks.done.tapPromise("rsbuild:done", onDone);
55
+ } catch {
56
+ compiler.hooks.done.tap("rsbuild:done", onDone);
57
+ }
47
58
  if (watch) {
48
59
  compiler.watch({}, (err) => {
49
60
  if (err) {
@@ -52,22 +63,19 @@ const build = async (initOptions, { mode = "production", watch, compiler: custom
52
63
  });
53
64
  return;
54
65
  }
55
- const { stats } = await new Promise(
56
- (resolve, reject) => {
57
- compiler.run((err, stats2) => {
58
- if (err || stats2?.hasErrors()) {
59
- const buildError = err || new Error("Webpack build failed!");
60
- reject(buildError);
61
- } else {
62
- compiler.close((closeErr) => {
63
- closeErr && import_shared.logger.error(closeErr);
64
- resolve({ stats: stats2 });
65
- });
66
- }
67
- });
68
- }
69
- );
70
- await context.hooks.onAfterBuild.call({ stats });
66
+ await new Promise((resolve, reject) => {
67
+ compiler.run((err, stats) => {
68
+ if (err || stats?.hasErrors()) {
69
+ const buildError = err || new Error("Webpack build failed!");
70
+ reject(buildError);
71
+ } else {
72
+ compiler.close((closeErr) => {
73
+ closeErr && import_shared.logger.error(closeErr);
74
+ resolve({ stats });
75
+ });
76
+ }
77
+ });
78
+ });
71
79
  };
72
80
  // Annotate the CommonJS export names for ESM import in node:
73
81
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/webpack",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "homepage": "https://rsbuild.dev",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,19 +29,19 @@
29
29
  "dependencies": {
30
30
  "fast-glob": "^3.3.1",
31
31
  "globby": "^11.1.0",
32
- "html-webpack-plugin": "npm:html-rspack-plugin@5.6.1",
32
+ "html-webpack-plugin": "npm:html-rspack-plugin@5.6.2",
33
33
  "mini-css-extract-plugin": "2.8.1",
34
34
  "postcss": "^8.4.33",
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.11",
39
- "@rsbuild/shared": "0.4.11"
38
+ "@rsbuild/core": "0.4.13",
39
+ "@rsbuild/shared": "0.4.13"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "16.x",
43
- "typescript": "^5.3.0",
44
- "@scripts/test-helper": "0.4.11"
43
+ "typescript": "^5.4.2",
44
+ "@scripts/test-helper": "0.4.13"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",