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/ModuleParseError.js | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/node_modules/webpack/lib/ModuleParseError.js b/node_modules/webpack/lib/ModuleParseError.js
index 54774bb..ee2f6a6 100644
--- a/node_modules/webpack/lib/ModuleParseError.js
+++ b/node_modules/webpack/lib/ModuleParseError.js
@@ -8,6 +8,7 @@
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
+/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").SourcePosition} SourcePosition */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
@@ -16,6 +17,7 @@
class ModuleParseError extends WebpackError {
/**
+ * Creates an instance of ModuleParseError.
* @param {string | Buffer} source source code
* @param {Error & { loc?: SourcePosition }} err the parse error
* @param {string[]} loaders the loaders used
@@ -23,10 +25,11 @@
*/
constructor(source, err, loaders, type) {
let message = `Module parse failed: ${err && err.message}`;
+ /** @type {undefined | DependencyLocation} */
let loc;
if (
- ((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) ||
+ ((Buffer.isBuffer(source) && source.subarray(0, 4).equals(WASM_HEADER)) ||
(typeof source === "string" && /^\0asm/.test(source))) &&
!type.startsWith("webassembly")
) {
@@ -40,7 +43,8 @@
"\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"').";
} else if (!loaders) {
message +=
- "\nYou may need an appropriate loader to handle this file type.";
+ "\nYou may need an appropriate loader to handle this file type. " +
+ "See https://webpack.js.org/concepts/loaders";
} else if (loaders.length >= 1) {
message += `\nFile was processed with these loaders:${loaders
.map((loader) => `\n * ${loader}`)
@@ -88,12 +92,14 @@
super(message);
+ /** @type {string} */
this.name = "ModuleParseError";
this.loc = loc;
this.error = err;
}
/**
+ * Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
@@ -105,6 +111,7 @@
}
/**
+ * Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
--
Gitblit v1.9.3