fix(nuxt): add exclude paths to nitro tsconfig.server.json (#22768)

This commit is contained in:
xxxhussein 2023-08-23 23:36:33 +03:00 committed by GitHub
parent 815230c1b5
commit 427e64d175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,6 +115,11 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
tsConfig: {
include: [
join(nuxt.options.buildDir, 'types/nitro-nuxt.d.ts')
],
exclude: [
...nuxt.options.modulesDir.map(m => relativeWithDot(nuxt.options.buildDir, m)),
// nitro generate output: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/core/nitro.ts#L186
relativeWithDot(nuxt.options.buildDir, resolve(nuxt.options.rootDir, 'dist'))
]
}
},
@ -403,3 +408,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
nuxt.hook('build:done', () => waitUntilCompile)
}
}
function relativeWithDot (from: string, to: string) {
return relative(from, to).replace(/^([^.])/, './$1') || '.'
}