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})/`)