fix(nuxi): only strip extensions from files (#22399)

This commit is contained in:
Ryota Watanabe 2023-07-30 18:11:50 +09:00 committed by GitHub
parent c044d0eef5
commit 8166fb20a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}
}