Registry / devops / vite-plugin-custom-tsconfig

vite-plugin-custom-tsconfig

JSON →
library1.0.4jsnpmunverified

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.

npm install vite-plugin-custom-tsconfig
INSTALL
IMPORT
SIG · VITE-PLUGIN-CUSTOM
V
vite-plugin-custom-tsconfig
devopsjavascriptv1.0.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import customTsConfig from 'vite-plugin-custom-tsconfig'
✗ const customTsConfig = require('vite-plugin-custom-tsconfig')
Uses default export, but named export also available. Since v1.0.3, both work.
customTsConfig
✓ import { customTsConfig } from 'vite-plugin-custom-tsconfig'
✗ import customTsConfig from 'vite-plugin-custom-tsconfig'
Named export added in v1.0.3. Prefer default import for simplicity.
Plugin
✓ import type { Plugin } from 'vite'
✗ import { Plugin } from 'vite-plugin-custom-tsconfig'
Plugin type is from Vite, not this package.

Shows how to use the plugin to set a custom tsconfig filename (tsconfig.app.json) in your Vite configuration.

// vite.config.ts import customTsConfig from 'vite-plugin-custom-tsconfig'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [ customTsConfig({ filename: 'tsconfig.app.json', }), ], });
Debug
Known issues
gotchaThe plugin copies and deletes tsconfig.json. Ensure no other tool relies on tsconfig.json being present at the same time.
fix
Run Vite builds sequentially or ensure other tools are not watching for tsconfig.json changes.
affects: >=1.0.0
gotchaThe 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.
fix
Ensure your custom tsconfig extends relative paths correctly.
affects: >=1.0.0
gotchaThe plugin may cause issues with editors (VS Code) that watch for tsconfig.json changes, as the file is temporarily replaced.
fix
Copy the custom tsconfig manually or use a symlink during development.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'vite-plugin-custom-tsconfig'
Package not installed or not in devDependencies.
fix
Run `npm install --save-dev vite-plugin-custom-tsconfig`
TypeError: customTsConfig is not a function
Using named import when package uses default export (or vice versa).
fix
Use `import customTsConfig from 'vite-plugin-custom-tsconfig'` or `import { customTsConfig } from 'vite-plugin-custom-tsconfig'` consistently.
ENOENT: no such file or directory, open 'tsconfig.build.json'
The specified filename does not exist in the project root.
fix
Create the file or adjust the `filename` option in the plugin config.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
vite-plugin-custom-tsconfig — npm install vite-plugin-custom-tsconfig · libregistry