Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nuxt): exclude nitro output dir from type checking #19532

Merged
merged 3 commits into from Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/nuxt/src/core/nitro.ts
@@ -1,5 +1,5 @@
import { existsSync, promises as fsp } from 'node:fs'
import { resolve, join } from 'pathe'
import { resolve, join, relative } from 'pathe'
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
import type { NitroConfig, Nitro } from 'nitropack'
import { logger, resolvePath } from '@nuxt/kit'
Expand Down Expand Up @@ -226,6 +226,9 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
await scanHandlers(nitro)
await writeTypes(nitro)
}
// Exclude nitro output dir from typescript
opts.tsConfig.exclude = opts.tsConfig.exclude || []
opts.tsConfig.exclude.push(relative(nuxt.options.buildDir, resolve(nuxt.options.rootDir, nitro.options.output.dir)))
opts.references.push({ path: resolve(nuxt.options.buildDir, 'types/nitro.d.ts') })
})

Expand Down