From 28ffb7fea027ade003035bfb345f9d796b8d4783 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 2 Nov 2022 04:53:23 -0400 Subject: [PATCH] fix(nuxt): add `vue-router` to optimized deps (#8544) --- packages/nuxt/src/pages/module.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nuxt/src/pages/module.ts b/packages/nuxt/src/pages/module.ts index b4e5fe7bee..38d5d91353 100644 --- a/packages/nuxt/src/pages/module.ts +++ b/packages/nuxt/src/pages/module.ts @@ -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',