{"id":26601,"library":"vite-plugin-tsc-build","title":"vite-plugin-tsc-build","description":"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.","status":"active","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/jpdutoit/vite-plugins","tags":["javascript","typescript"],"install":[{"cmd":"npm install vite-plugin-tsc-build","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-tsc-build","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-tsc-build","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin is designed to extend Vite's build pipeline.","package":"vite","optional":false},{"reason":"Runtime dependency; the plugin runs tsc to compile TypeScript files.","package":"typescript","optional":false}],"imports":[{"note":"ESM-only; this package ships as ESM and does not export a CommonJS version.","wrong":"const tscBuildPlugin = require('vite-plugin-tsc-build')","symbol":"tscBuildPlugin (default)","correct":"import tscBuildPlugin from 'vite-plugin-tsc-build'"},{"note":"Both default and named exports are available, but the named export avoids confusion with default import. Use whichever your project prefers.","wrong":"import tscBuildPlugin from 'vite-plugin-tsc-build'","symbol":"tscBuildPlugin (named)","correct":"import { tscBuildPlugin } from 'vite-plugin-tsc-build'"},{"note":"The plugin must be instantiated with options; omitting the parentheses will cause a runtime error.","wrong":"plugins: [tscBuildPlugin]","symbol":"Vite configuration","correct":"import { defineConfig } from 'vite';\nimport tscBuildPlugin from 'vite-plugin-tsc-build';\n\nexport default defineConfig({\n  plugins: [tscBuildPlugin({ enabled: true })]\n});"}],"quickstart":{"code":"// Install: npm install --save-dev vite-plugin-tsc-build typescript\n// vite.config.ts\nimport { defineConfig } from 'vite';\nimport tscBuildPlugin from 'vite-plugin-tsc-build';\n\nexport default defineConfig(({ mode }) => ({\n  plugins: [\n    tscBuildPlugin({\n      enabled: mode === 'production',\n      // Optionally override tsc command line arguments:\n      // tsc: ['-b', '--pretty']\n    })\n  ]\n}));","lang":"typescript","description":"Configures the plugin to run tsc -b only during production builds, preserving Vite's fast esbuild dev mode."},"warnings":[{"fix":"Ensure that enabled is set to false or conditionally disabled in dev mode (e.g., enabled: mode === 'production').","message":"The plugin only runs during build (when enabled) and does not affect the dev server. Development continues to use esbuild.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Install TypeScript as a dev dependency (npm install --save-dev typescript) and ensure it is in node_modules/.bin.","message":"The plugin expects a valid tsc command available in PATH. If tsc is not installed globally, the build may fail.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Either configure tsconfig.json with references or override the tsc arguments to '--noEmit' or a simple compilation command like ['--outDir', 'dist'].","message":"The plugin runs tsc -b (project build mode) by default. If your project does not have a tsconfig.json with references configured, the build may fail with 'Solution-style project' errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"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.","message":"Version 0.3.0 dropped support for Vite 3. Projects on Vite 3 must pin to 0.2.x or upgrade Vite.","severity":"breaking","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'0.3.0':61 '4':53 '5':54 '6':55 '7':57 'b':17 'build':5,20,79,85 'bundler':33 'cadenc':63 'compat':50 'compil':15,77 'const':47 'cost':82 'cross':45 'cross-modul':44 'current':58 'default':31 'differenti':66 'enabl':21 'enum':48 'esbuild':11,32 'fals':37 'featur':25 'full':68 'handl':27 'implicit':38 'import':42 'inlin':49 'irregular':65 'isolatedmodul':36 'javascript':86 'modul':46 'need':74 'plugin':3,8 'preserv':67 'product':19 'project':72 'releas':62 'replac':10 'semant':70 'slower':84 'strict':75 'support':22 'tsc':4,16,69 'type':40 'type-on':39 'typescript':14,24,76,87 'version':59 'vite':2,7,29,52 'vite-plugin-tsc-build':1","created_at":"2026-05-01T13:50:49.438522+00:00","updated_at":"2026-05-01T13:50:49.438522+00:00","problems":[{"fix":"Invoke the plugin: tscBuildPlugin({ enabled: true })","cause":"The plugin is used without calling it as a function, e.g., plugins: [tscBuildPlugin] instead of plugins: [tscBuildPlugin({})].","error":"Error: The plugin must be instantiated with options."},{"fix":"Run npm install --save-dev typescript. Ensure node_modules/.bin is in your PATH or use npx tsc.","cause":"TypeScript is not installed or not in PATH.","error":"tsc: command not found"},{"fix":"Set 'isolatedModules': false in your tsconfig.json (only if you need features like implicit type-only imports).","cause":"The plugin may be processing files with TypeScript features that require isolatedModules: false, but the tsconfig has isolatedModules: true.","error":"error TS5094: Function calls are not allowed in a file without '--isolatedModules'."},{"fix":"Run npm install --save-dev vite-plugin-tsc-build. If using TypeScript, ensure your tsconfig includes node_modules types.","cause":"The package is missing or is installed incorrectly.","error":"Cannot find module 'vite-plugin-tsc-build' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jpdutoit/vite-plugins","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-tsc-build","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}