{"id":22635,"library":"vite-plugin-custom-tsconfig","title":"vite-plugin-custom-tsconfig","description":"A Vite plugin (v1.0.4, latest) that lets you use custom tsconfig filenames like tsconfig.build.json or tsconfig.app.json with Vite. It works by copying your chosen tsconfig.*.json to tsconfig.json before Vite starts and removing it after the build finishes. This is a simple solution for monorepos or projects needing different TypeScript configurations for different environments. The plugin is lightweight, has no dependencies, and supports both ESM and CJS imports. Unlike alternatives like tsconfig-paths-webpack-plugin for Webpack, this plugin is Vite-specific and focuses solely on swapping tsconfig.json files.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/edielemoine/vite-plugin-custom-tsconfig","tags":["javascript","typescript"],"install":[{"cmd":"npm install vite-plugin-custom-tsconfig","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-custom-tsconfig","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-custom-tsconfig","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Uses default export, but named export also available. Since v1.0.3, both work.","wrong":"const customTsConfig = require('vite-plugin-custom-tsconfig')","symbol":"default","correct":"import customTsConfig from 'vite-plugin-custom-tsconfig'"},{"note":"Named export added in v1.0.3. Prefer default import for simplicity.","wrong":"import customTsConfig from 'vite-plugin-custom-tsconfig'","symbol":"customTsConfig","correct":"import { customTsConfig } from 'vite-plugin-custom-tsconfig'"},{"note":"Plugin type is from Vite, not this package.","wrong":"import { Plugin } from 'vite-plugin-custom-tsconfig'","symbol":"Plugin","correct":"import type { Plugin } from 'vite'"}],"quickstart":{"code":"// vite.config.ts\nimport customTsConfig from 'vite-plugin-custom-tsconfig';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  plugins: [\n    customTsConfig({\n      filename: 'tsconfig.app.json',\n    }),\n  ],\n});","lang":"typescript","description":"Shows how to use the plugin to set a custom tsconfig filename (tsconfig.app.json) in your Vite configuration."},"warnings":[{"fix":"Run Vite builds sequentially or ensure other tools are not watching for tsconfig.json changes.","message":"The plugin copies and deletes tsconfig.json. Ensure no other tool relies on tsconfig.json being present at the same time.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your custom tsconfig extends relative paths correctly.","message":"The plugin does not resolve paths or merge configs; it simply overwrites tsconfig.json with the specified file. If your custom tsconfig references other configs via extends, those must be correctly relative.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Copy the custom tsconfig manually or use a symlink during development.","message":"The plugin may cause issues with editors (VS Code) that watch for tsconfig.json changes, as the file is temporarily replaced.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev vite-plugin-custom-tsconfig`","cause":"Package not installed or not in devDependencies.","error":"Cannot find module 'vite-plugin-custom-tsconfig'"},{"fix":"Use `import customTsConfig from 'vite-plugin-custom-tsconfig'` or `import { customTsConfig } from 'vite-plugin-custom-tsconfig'` consistently.","cause":"Using named import when package uses default export (or vice versa).","error":"TypeError: customTsConfig is not a function"},{"fix":"Create the file or adjust the `filename` option in the plugin config.","cause":"The specified filename does not exist in the project root.","error":"ENOENT: no such file or directory, open 'tsconfig.build.json'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}