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/DllPlugin.js | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/node_modules/webpack/lib/DllPlugin.js b/node_modules/webpack/lib/DllPlugin.js
index 1dc009f..f915cf8 100644
--- a/node_modules/webpack/lib/DllPlugin.js
+++ b/node_modules/webpack/lib/DllPlugin.js
@@ -8,42 +8,43 @@
const DllEntryPlugin = require("./DllEntryPlugin");
const FlagAllModulesAsUsedPlugin = require("./FlagAllModulesAsUsedPlugin");
const LibManifestPlugin = require("./LibManifestPlugin");
-const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DllEntryPlugin").Entries} Entries */
/** @typedef {import("./DllEntryPlugin").Options} Options */
-const validate = createSchemaValidation(
- require("../schemas/plugins/DllPlugin.check"),
- () => require("../schemas/plugins/DllPlugin.json"),
- {
- name: "Dll Plugin",
- baseDataPath: "options"
- }
-);
-
const PLUGIN_NAME = "DllPlugin";
class DllPlugin {
/**
+ * Creates an instance of DllPlugin.
* @param {DllPluginOptions} options options object
*/
constructor(options) {
- validate(options);
- this.options = {
- ...options,
- entryOnly: options.entryOnly !== false
- };
+ /** @type {DllPluginOptions} */
+ this.options = options;
}
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
+ compiler.hooks.validate.tap(PLUGIN_NAME, () => {
+ compiler.validate(
+ () => require("../schemas/plugins/DllPlugin.json"),
+ this.options,
+ {
+ name: "Dll Plugin",
+ baseDataPath: "options"
+ },
+ (options) => require("../schemas/plugins/DllPlugin.check")(options)
+ );
+ });
+
+ const entryOnly = this.options.entryOnly !== false;
compiler.hooks.entryOption.tap(PLUGIN_NAME, (context, entry) => {
if (typeof entry !== "function") {
for (const name of Object.keys(entry)) {
@@ -63,8 +64,8 @@
}
return true;
});
- new LibManifestPlugin(this.options).apply(compiler);
- if (!this.options.entryOnly) {
+ new LibManifestPlugin({ ...this.options, entryOnly }).apply(compiler);
+ if (!entryOnly) {
new FlagAllModulesAsUsedPlugin(PLUGIN_NAME).apply(compiler);
}
}
--
Gitblit v1.9.3