config中添加插件类型支持

This commit is contained in:
pqcqaq 2024-12-08 01:19:18 +08:00
parent 6e211b447c
commit dd03257367
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -9,6 +9,8 @@ type SplitChunks = Required<OptimizationType>['splitChunks'];
type CacheGroups = Exclude<SplitChunks, false>["cacheGroups"];
type ExternalsType = Required<WebpackConfiguration>['externals'];
type ExternalsObjectType = Exclude<ExternalsType, RegExp | string | Function | Array<any>>;
type PluginType = Required<WebpackConfiguration>['plugins'];
type PluginInstanceType = PluginType extends Array<infer T> ? Exclude<T, false| number | string | Function | null | undefined> : never
/**
*
@ -24,6 +26,7 @@ export type CompilerConfiguration = {
cacheGroups: CacheGroups;
},
externals?: ExternalsObjectType;
plugins?: PluginInstanceType[];
},
};