From d1c422cd7f4fa01fda938774b9c0e0dae3907f87 Mon Sep 17 00:00:00 2001 From: Justin Helmer Date: Wed, 14 Dec 2022 08:33:55 -0800 Subject: [PATCH] fix(typescript): Support custom path in build mode (#186) Co-authored-by: Justin Helmer --- .../vite-plugin-checker/src/checkers/typescript/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vite-plugin-checker/src/checkers/typescript/main.ts b/packages/vite-plugin-checker/src/checkers/typescript/main.ts index e4843e4d..7b521931 100644 --- a/packages/vite-plugin-checker/src/checkers/typescript/main.ts +++ b/packages/vite-plugin-checker/src/checkers/typescript/main.ts @@ -152,7 +152,13 @@ export class TscChecker extends Checker<'typescript'> { // Custom config path if (tsconfigPath) { const fullConfigPath = root ? path.join(root, tsconfigPath) : tsconfigPath - args = args.concat(['-p', fullConfigPath]) + + // In build mode, the tsconfig path is an argument to -b, e.g. "tsc -b [path]" + if (buildMode) { + args = args.concat([fullConfigPath]) + } else { + args = args.concat(['-p', fullConfigPath]) + } } return ['tsc', args]