fix(vite): dedupe/optimize more vue core deps (#20829)

This commit is contained in:
Daniel Roe 2023-05-14 12:56:15 +01:00 committed by GitHub
parent 7006064567
commit ebbda2cbe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -48,7 +48,14 @@ export async function buildClient (ctx: ViteBuildContext) {
'#build/plugins': resolve(ctx.nuxt.options.buildDir, 'plugins/client'),
'#internal/nitro': resolve(ctx.nuxt.options.buildDir, 'nitro.client.mjs')
},
dedupe: ['vue']
dedupe: [
'vue',
// basic reactivity
'@vue/reactivity', '@vue/runtime-core', '@vue/runtime-dom', '@vue/shared',
// runtime compiler
'@vue/compiler-sfc', '@vue/compiler-dom', '@vue/compiler-core', '@vue/compiler-ssr'
]
},
cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite', 'client'),
build: {

View File

@ -67,7 +67,7 @@ export async function bundle (nuxt: Nuxt) {
}
},
optimizeDeps: {
include: ['vue'],
include: ['vue', '@vue/reactivity', '@vue/runtime-core', '@vue/runtime-dom', '@vue/shared'],
exclude: ['nuxt/app']
},
css: resolveCSSOptions(nuxt),