Vite plugin to specify an alternate tsconfig filename, useful for monorepos and CI environments. Current stable version is 2.0.0, released with breaking changes migrating to buildStart/buildEnd hooks. Key differentiator: allows swapping tsconfig files per workspace package in monorepos, with backup/restore of the original tsconfig.json. Note that as of Vite 7.1.5, the native optimizeDeps.esbuildOptions.tsconfig option may suffice, but this plugin remains necessary for monorepos with externalized paths.
npm install vite-plugin-tsconfigVerified import paths — ran on the pinned version, not inferred.
Configures Vite to use an alternate tsconfig file during build, with optional workspace packages for monorepos.
Update plugin configuration if relying on specific hook behavior; in most cases no code changes are needed.
Consider removing the plugin and using Vite's native esbuildOptions.tsconfig.
Ensure proper error handling or have version control to recover the original tsconfig.json.
Explicitly list all workspace packages that need the alternate tsconfig.
Place vite-plugin-tsconfig early in the plugins array.
Install the package: npm install -D vite-plugin-tsconfig
Use ES module import: import tsconfig from 'vite-plugin-tsconfig'
Update Vite: npm install vite@latest
Ensure the file exists or create it. Check the filename option.
Add the workspace package name to the workspaces array.