fix(nuxt): add vue-router to optimized deps (#8544)

This commit is contained in:
Daniel Roe 2022-11-02 04:53:23 -04:00 committed by GitHub
parent 80871e7235
commit 28ffb7fea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,6 +162,11 @@ export default defineNuxtModule({
getContents: () => 'export { useRoute } from \'vue-router\''
})
// Optimize vue-router to ensure we share the same injection symbol
nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {}
nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || []
nuxt.options.vite.optimizeDeps.include.push('vue-router')
// Add router options template
addTemplate({
filename: 'router.options.mjs',