mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
feat(kit): support client and server flags for addVitePlugin
(#5560)
This commit is contained in:
parent
2156079405
commit
308148977d
@ -15,9 +15,6 @@ export interface ExtendConfigOptions {
|
|||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
build?: boolean
|
build?: boolean
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
||||||
/**
|
/**
|
||||||
* Install plugin on server side
|
* Install plugin on server side
|
||||||
*
|
*
|
||||||
@ -30,6 +27,9 @@ export interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
client?: boolean
|
client?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
||||||
/**
|
/**
|
||||||
* Install plugin on modern build
|
* Install plugin on modern build
|
||||||
*
|
*
|
||||||
@ -99,7 +99,14 @@ export function extendViteConfig (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
nuxt.hook('vite:extend', ({ config }) => fn(config))
|
nuxt.hook('vite:extendConfig', (config, { isClient, isServer }) => {
|
||||||
|
if (options.server !== false && isServer) {
|
||||||
|
return fn(config)
|
||||||
|
}
|
||||||
|
if (options.client !== false && isClient) {
|
||||||
|
return fn(config)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user