diff --git a/packages/nuxt/src/components/templates.ts b/packages/nuxt/src/components/templates.ts index 8f162cea988..bf085cb0be3 100644 --- a/packages/nuxt/src/components/templates.ts +++ b/packages/nuxt/src/components/templates.ts @@ -75,7 +75,9 @@ export const componentsTypeTemplate: NuxtTemplate = { const buildDir = nuxt.options.buildDir const componentTypes = options.getComponents().map(c => [ c.pascalName, - `typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(buildDir, c.filePath) : c.filePath, { wrapper: false })}['${c.export}']` + `typeof ${genDynamicImport(isAbsolute(c.filePath) + ? relative(buildDir, c.filePath).replace(/(?<=\w)\.(?!vue)\w+$/g, '') + : c.filePath.replace(/(?<=\w)\.(?!vue)\w+$/g, ''), { wrapper: false })}['${c.export}']` ]) return `// Generated by components discovery