From 2b35e92bd73102dc7ef46e1913fbdec1c206b411 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 2 Nov 2021 09:39:42 +0000 Subject: [PATCH] fix(nuxt3): add `vue-router` types when used (#1603) --- packages/nuxt3/src/pages/module.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nuxt3/src/pages/module.ts b/packages/nuxt3/src/pages/module.ts index 34c6ab83c8..56d0bf3a25 100644 --- a/packages/nuxt3/src/pages/module.ts +++ b/packages/nuxt3/src/pages/module.ts @@ -15,6 +15,11 @@ export default defineNuxtModule({ return } + // Add $router types + nuxt.hook('prepare:types', ({ references }) => { + references.push({ types: 'vue-router' }) + }) + // Regenerate templates when adding or removing pages nuxt.hook('builder:watch', async (event, path) => { const pathPattern = new RegExp(`^(${nuxt.options.dir.pages}|${nuxt.options.dir.layouts})/`)