fix: use a relative tsconfig root for the TypeScript checker - #25209
Conversation
vite-plugin-checker builds the tsc command line as a string and splits it on spaces, so the absolute "-p <root>" argument breaks type checking when the project directory contains a space. Vite is always started with the project root as its working directory, both for the production build and for the dev server, so a relative "." resolves to the same tsconfig.json without introducing a splittable argument.
|
|
Cross-reference: this change has a side effect that looks unintended — see vaadin/hilla#6040 for the full context.
// vite-plugin-checker@0.14.5/dist/checkers/typescript/main.js
try {
const tsEntry = createRequire(path.join(finalConfig.root, "noop.js")).resolve(finalConfig.typescriptPath);
...
tscBin = path.join(dir, "bin", "tsc");
runWithNode = existsSync(tscBin);
} catch {}
// otherwise:
spawn("tsc", args, { cwd: finalConfig.root, shell: true })
Reproduced on a minimal Vite 8 project using the generated Vaadin So dev-mode type checking currently depends on the developer's The argument-splitting problem this PR addresses could be solved without making the path relative — |
|
If fi3ework/vite-plugin-checker#792 is merged, we can revert to dirname |



vite-plugin-checker builds the tsc command line as a string and splits it on spaces, so the absolute "-p " argument breaks type checking when the project directory contains a space. Vite is always started with the project root as its working directory, both for the production build and for the dev server, so a relative "." resolves to the same tsconfig.json without introducing a splittable argument.