From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送

---
 node_modules/webpack/lib/HookWebpackError.js |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/node_modules/webpack/lib/HookWebpackError.js b/node_modules/webpack/lib/HookWebpackError.js
index 09d45a6..b6dc5af 100644
--- a/node_modules/webpack/lib/HookWebpackError.js
+++ b/node_modules/webpack/lib/HookWebpackError.js
@@ -6,8 +6,13 @@
 "use strict";
 
 const WebpackError = require("./WebpackError");
+const makeSerializable = require("./util/makeSerializable");
+
+/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
+/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
 
 /**
+ * Defines the callback callback.
  * @template T
  * @callback Callback
  * @param {Error | null} err
@@ -22,21 +27,50 @@
 	 * @param {string} hook name of hook
 	 */
 	constructor(error, hook) {
-		super(error.message);
+		super(error ? error.message : undefined, error ? { cause: error } : {});
 
-		this.name = "HookWebpackError";
 		this.hook = hook;
 		this.error = error;
+		/** @type {string} */
+		this.name = "HookWebpackError";
 		this.hideStack = true;
-		this.details = `caused by plugins in ${hook}\n${error.stack}`;
+		this.stack += `\n-- inner error --\n${error ? error.stack : ""}`;
+		this.details = `caused by plugins in ${hook}\n${error ? error.stack : ""}`;
+	}
 
-		this.stack += `\n-- inner error --\n${error.stack}`;
+	/**
+	 * Serializes this instance into the provided serializer context.
+	 * @param {ObjectSerializerContext} context context
+	 */
+	serialize(context) {
+		const { write } = context;
+
+		write(this.error);
+		write(this.hook);
+
+		super.serialize(context);
+	}
+
+	/**
+	 * Restores this instance from the provided deserializer context.
+	 * @param {ObjectDeserializerContext} context context
+	 */
+	deserialize(context) {
+		const { read } = context;
+
+		this.error = read();
+		this.hook = read();
+
+		super.deserialize(context);
 	}
 }
+
+makeSerializable(HookWebpackError, "webpack/lib/HookWebpackError");
 
 module.exports = HookWebpackError;
 
 /**
+ * Creates webpack error.
  * @param {Error} error an error
  * @param {string} hook name of the hook
  * @returns {WebpackError} a webpack error
@@ -49,6 +83,7 @@
 module.exports.makeWebpackError = makeWebpackError;
 
 /**
+ * Creates webpack error callback.
  * @template T
  * @param {(err: WebpackError | null, result?: T) => void} callback webpack error callback
  * @param {string} hook name of hook
@@ -69,12 +104,14 @@
 module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback;
 
 /**
+ * Try run or webpack error.
  * @template T
  * @param {() => T} fn function which will be wrapping in try catch
  * @param {string} hook name of hook
  * @returns {T} the result
  */
 const tryRunOrWebpackError = (fn, hook) => {
+	/** @type {T} */
 	let r;
 	try {
 		r = fn();

--
Gitblit v1.9.3