Skip to content

Commit

Permalink
fix: TS checker should respect custom tsconfig (#39)
Browse files Browse the repository at this point in the history
* fix: TS checker should respect custom tsconfig

* fix: use correct process argument passing

* fix: include root in tsconfig path if specified
  • Loading branch information
zsparal authored Jul 19, 2021
1 parent 2b39c80 commit 948920d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/vite-plugin-checker/src/checkers/typescript/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os from 'os'
import path from 'path'
import invariant from 'tiny-invariant'
import ts from 'typescript'
import { parentPort } from 'worker_threads'
Expand Down Expand Up @@ -120,7 +121,17 @@ export class TscChecker extends Checker<'typescript'> {
super({
name: 'typescript',
absFilePath: __filename,
build: { buildBin: ['tsc', ['--noEmit']] },
build: {
buildBin: (config) => {
if (typeof config.typescript === 'object' && config.typescript.tsconfigPath) {
const tsconfig = config.typescript.root
? path.join(config.typescript.root, config.typescript.tsconfigPath)
: config.typescript.tsconfigPath
return ['tsc', ['--noEmit', '-p', tsconfig]]
}
return ['tsc', ['--noEmit']]
},
},
createDiagnostic,
})
}
Expand Down

0 comments on commit 948920d

Please sign in to comment.