A Vite plugin that replaces esbuild with the TypeScript compiler (tsc -b) for production builds. Enables support for TypeScript features not handled by Vite's default esbuild bundler, such as isolatedModules: false, implicit type-only imports, and cross-module const enum inlining. Compatible with Vite 4, 5, 6, and 7. Current version is 0.3.0; release cadence is irregular. Differentiator: preserves full tsc semantics for projects that need strict TypeScript compilation during build, at the cost of slower builds.
npm install vite-plugin-tsc-buildNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures the plugin to run tsc -b only during production builds, preserving Vite's fast esbuild dev mode.
Ensure that enabled is set to false or conditionally disabled in dev mode (e.g., enabled: mode === 'production').
Install TypeScript as a dev dependency (npm install --save-dev typescript) and ensure it is in node_modules/.bin.
Either configure tsconfig.json with references or override the tsc arguments to '--noEmit' or a simple compilation command like ['--outDir', 'dist'].
Update Vite to ^4.0.0, ^5.0.0, ^6.0.0, or ^7.0.0, or stay on vite-plugin-tsc-build@0.2.x.
Invoke the plugin: tscBuildPlugin({ enabled: true })Run npm install --save-dev typescript. Ensure node_modules/.bin is in your PATH or use npx tsc.
Set 'isolatedModules': false in your tsconfig.json (only if you need features like implicit type-only imports).
Run npm install --save-dev vite-plugin-tsc-build. If using TypeScript, ensure your tsconfig includes node_modules types.