From dd032573672e38ae62cb7dd82d668948522253e7 Mon Sep 17 00:00:00 2001 From: pqcqaq <905739777@qq.com> Date: Sun, 8 Dec 2024 01:19:18 +0800 Subject: [PATCH] =?UTF-8?q?config=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/web/webpack.config.js | 3 ++- src/createConfig.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/web/webpack.config.js b/config/web/webpack.config.js index 7079ffb..331c277 100644 --- a/config/web/webpack.config.js +++ b/config/web/webpack.config.js @@ -1042,7 +1042,8 @@ module.exports = function (webpackEnv) { color: "#85d", // 默认green,进度条颜色支持HEX basic: false, // 默认true,启用一个简单的日志报告器 profile:false, // 默认false,启用探查器。 - }) + }), + ...(projectConfiguration && projectConfiguration.plugins ? projectConfiguration.plugins : []), ].filter(Boolean), // Turn off performance processing because we utilize // our own hints via the FileSizeReporter diff --git a/src/createConfig.ts b/src/createConfig.ts index cef803e..016e15a 100644 --- a/src/createConfig.ts +++ b/src/createConfig.ts @@ -9,6 +9,8 @@ type SplitChunks = Required['splitChunks']; type CacheGroups = Exclude["cacheGroups"]; type ExternalsType = Required['externals']; type ExternalsObjectType = Exclude>; +type PluginType = Required['plugins']; +type PluginInstanceType = PluginType extends Array ? Exclude : never /** * 编译环境配置 @@ -24,6 +26,7 @@ export type CompilerConfiguration = { cacheGroups: CacheGroups; }, externals?: ExternalsObjectType; + plugins?: PluginInstanceType[]; }, };