From 90eacb6f75dd7e96ef19707363488bb73c5c8df8 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Mon, 18 Oct 2021 19:11:08 +1100 Subject: [PATCH] fix(kit): support modern builds with `extendWebpackConfig` (#1055) --- packages/kit/src/module/utils.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/kit/src/module/utils.ts b/packages/kit/src/module/utils.ts index 88a6158a30..bc5b907e03 100644 --- a/packages/kit/src/module/utils.ts +++ b/packages/kit/src/module/utils.ts @@ -180,6 +180,13 @@ export interface ExtendWebpackConfigOptions extends ExtendConfigOptions { * @default true */ client?: boolean + /** + * Install plugin on modern build + * + * @default true + * @deprecated Nuxt 2 only + */ + modern?: boolean } export interface ExtendViteConfigOptions extends ExtendConfigOptions {} @@ -216,6 +223,13 @@ export function extendWebpackConfig ( fn(config) } } + // Nuxt 2 backwards compatibility + if (options.modern !== false) { + const config = configs.find(i => i.name === 'modern') + if (config) { + fn(config) + } + } }) }