mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-01 18:07:22 +00:00
fix(vite): resolve tsconfig.json
for vue-tsc type checker (#6069)
This commit is contained in:
parent
8d469e7f15
commit
cccafd620f
@ -1,3 +1,4 @@
|
|||||||
|
import { resolveTSConfig } from 'pkg-types'
|
||||||
import { resolve, normalize } from 'pathe'
|
import { resolve, normalize } from 'pathe'
|
||||||
import * as vite from 'vite'
|
import * as vite from 'vite'
|
||||||
import vuePlugin from '@vitejs/plugin-vue'
|
import vuePlugin from '@vitejs/plugin-vue'
|
||||||
@ -107,7 +108,11 @@ export async function buildServer (ctx: ViteBuildContext) {
|
|||||||
// Add type-checking
|
// Add type-checking
|
||||||
if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) {
|
if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) {
|
||||||
const checker = await import('vite-plugin-checker').then(r => r.default)
|
const checker = await import('vite-plugin-checker').then(r => r.default)
|
||||||
serverConfig.plugins.push(checker({ vueTsc: true }))
|
serverConfig.plugins.push(checker({
|
||||||
|
vueTsc: {
|
||||||
|
tsconfigPath: await resolveTSConfig(ctx.nuxt.options.rootDir)
|
||||||
|
}
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
await ctx.nuxt.callHook('vite:extendConfig', serverConfig, { isClient: false, isServer: true })
|
await ctx.nuxt.callHook('vite:extendConfig', serverConfig, { isClient: false, isServer: true })
|
||||||
|
Loading…
Reference in New Issue
Block a user