Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
feat: support addWebpackPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 18, 2022
1 parent b969a7b commit 1a682ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/kit/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,14 @@ export function extendViteConfig (
/**
* Append Webpack plugin to the config.
*/
export function addWebpackPlugin (plugin: WebpackPluginInstance, options?: ExtendWebpackConfigOptions) {
export function addWebpackPlugin (plugin: WebpackPluginInstance | WebpackPluginInstance[], options?: ExtendWebpackConfigOptions) {
extendWebpackConfig((config) => {
config.plugins = config.plugins || []
config.plugins.push(plugin)
if (Array.isArray(plugin)) {
config.plugins.push(...plugin)
} else {
config.plugins.push(plugin)
}
}, options)
}

Expand Down

0 comments on commit 1a682ce

Please sign in to comment.