fix(kit): support modern builds with `extendWebpackConfig` (#1055)

This commit is contained in:
Harlan Wilton 2021-10-18 19:11:08 +11:00 committed by GitHub
parent 0591350f5b
commit 90eacb6f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

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