fix(kit): only call viteExtendConfig callback once if possible (#5929)

This commit is contained in:
Daniel Roe 2022-07-15 22:34:29 +01:00 committed by GitHub
parent 78d4eabc41
commit a54925f880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,6 +99,11 @@ export function extendViteConfig (
return
}
if (options.server !== false && options.client !== false) {
// Call fn() only once
return nuxt.hook('vite:extend', ({ config }) => fn(config))
}
nuxt.hook('vite:extendConfig', (config, { isClient, isServer }) => {
if (options.server !== false && isServer) {
return fn(config)