From 8166fb20a544c1d3692a2822d7891d72fb78e65a Mon Sep 17 00:00:00 2001 From: Ryota Watanabe <43837308+wattanx@users.noreply.github.com> Date: Sun, 30 Jul 2023 18:11:50 +0900 Subject: [PATCH] fix(nuxi): only strip extensions from files (#22399) --- packages/nuxi/src/utils/prepare.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nuxi/src/utils/prepare.ts b/packages/nuxi/src/utils/prepare.ts index d9592fbde9..bdcb64fda6 100644 --- a/packages/nuxi/src/utils/prepare.ts +++ b/packages/nuxi/src/utils/prepare.ts @@ -73,10 +73,14 @@ export const writeTypes = async (nuxt: Nuxt) => { tsConfig.include.push(`${absolutePath}/*`) } } else { - tsConfig.compilerOptions.paths[alias] = [absolutePath.replace(/(?<=\w)\.\w+$/g, '')] /* remove extension */ + const path = stats?.isFile() + ? absolutePath.replace(/(?<=\w)\.\w+$/g, '') /* remove extension */ + : absolutePath + + tsConfig.compilerOptions.paths[alias] = [path] if (!absolutePath.startsWith(rootDirWithSlash)) { - tsConfig.include.push(absolutePath.replace(/(?<=\w)\.\w+$/g, '')) + tsConfig.include.push(path) } } }