From 7e73091d5d42f3bf6b9a8144627b28d6826af1ba Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 20 Sep 2022 09:02:09 +0100 Subject: [PATCH] fix(nuxt): strip non-`.vue` extensions from component types --- packages/nuxt/src/components/templates.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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