vite-plugin-tsc
raw JSON → 0.1.1 verified Mon Apr 27 auth: no javascript
A Vite plugin that spawns an external `tsc --watch` process alongside the Vite dev server, providing TypeScript type checking without interfering with Vite's own transpilation. Current version 0.1.1. Release cadence is low (sporadic). Key differentiator: unlike fork-ts-checker-webpack-plugin for webpack or vite-plugin-checker, this plugin strictly uses `tsc --watch` and deliberately avoids any bundler integration, giving a pure TypeScript checker experience. It utilizes the `configResolved` hook and is not compatible with other bundlers.
Common errors
error Error: Cannot find module 'vite-plugin-tsc' ↓
cause The package is not installed.
fix
Run
npm install -D vite-plugin-tsc in your project directory. error TypeError: tscPlugin is not a function ↓
cause Using named import instead of default import.
fix
Use
import tscPlugin from 'vite-plugin-tsc' (default import) instead of import { tscPlugin } from 'vite-plugin-tsc'. error TypeError: (0 , vitePluginTsc_1.default) is not a function ↓
cause CommonJS require() with destructuring or wrong call.
fix
Use
const tscPlugin = require('vite-plugin-tsc') and then call tscPlugin(). error Cannot find name 'tscPlugin' ↓
cause TypeScript config not recognizing the import; likely missing type declaration.
fix
Install
@types/node if needed, or add vite-plugin-tsc to types in tsconfig.json. Warnings
gotcha The plugin does not pass configuration options to `tsc`. It always runs `tsc --watch` with default settings. ↓
fix Configure `tsc` via `tsconfig.json` or command-line flags passed to the plugin if supported (currently not).
gotcha Setting `logLevel: 'silent'` suppresses Vite's own logs but not `tsc` output. Some Vite logs may still appear. ↓
fix Use `logLevel: 'silent'` as recommended, but be aware it silences Vite logs, not tsc output.
gotcha The plugin is Vite-only and will not work with other build tools (e.g., webpack, Rollup standalone). ↓
fix Ensure you are using Vite as the build tool. For other tools, consider fork-ts-checker-webpack-plugin or other alternatives.
breaking The plugin currently has no options object; calling `tscPlugin(options)` will silently ignore options. ↓
fix No options are supported. Future versions may accept an options object.
Install
npm install vite-plugin-tsc yarn add vite-plugin-tsc pnpm add vite-plugin-tsc Imports
- tscPlugin wrong
import { tscPlugin } from 'vite-plugin-tsc'correctimport tscPlugin from 'vite-plugin-tsc' - default import (tscPlugin) wrong
const { tscPlugin } = require('vite-plugin-tsc')correctconst tscPlugin = require('vite-plugin-tsc') - Plugin type (TypeScript) wrong
import type { TscPlugin } from 'vite-plugin-tsc'correctimport type { Plugin } from 'vite'
Quickstart
// vite.config.js
import tscPlugin from 'vite-plugin-tsc'
export default {
plugins: [
tscPlugin()
],
logLevel: 'silent'
}