From 1f2ca536101d54649c6abc34e9665c2163878b56 Mon Sep 17 00:00:00 2001 From: Rom Date: Fri, 15 Apr 2022 07:45:26 +0200 Subject: [PATCH] fix: `apply` condition skipped for nested plugins (#7741) --- packages/vite/src/node/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index f633d1158bfa95..a30d84465e9990 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -63,7 +63,7 @@ export function defineConfig(config: UserConfigExport): UserConfigExport { return config } -export type PluginOption = Plugin | false | null | undefined +export type PluginOption = Plugin | false | null | undefined | PluginOption[] export interface UserConfig { /** @@ -109,7 +109,7 @@ export interface UserConfig { /** * Array of vite plugins to use. */ - plugins?: (PluginOption | PluginOption[])[] + plugins?: PluginOption[] /** * Configure resolver */ @@ -199,7 +199,7 @@ export interface UserConfig { /** * Vite plugins that apply to worker bundle */ - plugins?: (PluginOption | PluginOption[])[] + plugins?: PluginOption[] /** * Rollup options to build worker bundle */ @@ -322,7 +322,7 @@ export async function resolveConfig( configEnv.mode = mode // resolve plugins - const rawUserPlugins = (config.plugins || []).flat().filter((p) => { + const rawUserPlugins = (config.plugins || []).flat(Infinity).filter((p) => { if (!p) { return false } else if (!p.apply) {