vite-plugin-tsc-watch

raw JSON →
3.1.2 verified Mon Apr 27 auth: no javascript

Plugs tsc --watch into Vite dev server, enabling TypeScript type-checking during development without blocking the build pipeline. Current stable version is 3.1.2 (Feb 2025), with releases roughly every 6 months tracking Vite and TypeScript peer updates. Key differentiators: dev-only, low-noise (no overlay), uses Vite's dev server for logging, lightweight compared to alternatives like fork-ts-checker-webpack-plugin. Supports TS solution config and ESM-only since v3.

error Error: The plugin 'vite-plugin-tsc-watch' requires a named export 'tscWatch'
cause Using default import after v3.0.1 when plugin switched to ESM and named export.
fix
Replace import tscWatch from ... with import { tscWatch } from 'vite-plugin-tsc-watch'.
error TypeError: vitePluginTscWatch is not a function
cause Using `const tscWatch = require('vite-plugin-tsc-watch')` in CJS context after v3.0.1 (ESM-only).
fix
Switch to ESM import or use dynamic import: const { tscWatch } = await import('vite-plugin-tsc-watch').
error Error: Cannot find module 'vite-plugin-tsc-watch' or its corresponding type declarations.
cause Missing or incompatible peer dependencies (typescript or vite).
fix
Run npm install -D typescript vite to install peer dependencies.
breaking Default export removed in v2.0.0, replaced with named export `tscPlugin`. In v3.0.1, renamed to `tscWatch`.
fix Use `import { tscWatch } from 'vite-plugin-tsc-watch'` instead of default import.
breaking ESM-only since v3.0.1; CommonJS require() is deprecated but still works with a warning.
fix Switch to ESM imports or migrate Vite to ESM (see Vite migration guide).
breaking Dropped support for Vite 2 & 3 and Node <18 in v3.0.1.
fix Upgrade to Vite 4+ and Node 18+.
deprecated The named export `tscPlugin` (v2.0.0 to v3.0.0) is deprecated; use `tscWatch` instead.
fix Rename `tscPlugin` to `tscWatch` in your imports.
gotcha The plugin does not emit compiled JS files; you must set `noEmit: true` in tsconfig to avoid file pollution.
fix Add `"noEmit": true` to `compilerOptions` in your tsconfig.json.
npm install vite-plugin-tsc-watch
yarn add vite-plugin-tsc-watch
pnpm add vite-plugin-tsc-watch

Import the named export `tscWatch` and add it to the Vite plugins array.

import { defineConfig } from 'vite';
import { tscWatch } from 'vite-plugin-tsc-watch';

export default defineConfig({
  plugins: [tscWatch()],
});