Registry / web-framework / vite-resolve-tsconfig-paths

vite-resolve-tsconfig-paths

JSON →
library0.0.10jsnpmunverified

A Vite plugin that resolves TypeScript compilerOptions.paths, supporting tsconfig extends and references in subdirectories. Current stable version is 0.0.10. The plugin uses tsconfck to parse all tsconfig.json project files, including references, and creates resolvers based on the compiled paths. It differentiates from alternatives like vite-tsconfig-paths by supporting extends and references in sub-folders out of the box. Release cadence is irregular with a few minor versions since its inception. The plugin is TypeScript-first, ships types, and requires Vite as a peer dependency.

npm install vite-resolve-tsconfig-paths
INSTALL
IMPORT
SIG · VITE-RESOLVE-TSCON
V
vite-resolve-tsconfig-paths
web-frameworkjavascriptv0.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

tsConfigPaths
import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'
const tsConfigPaths = require('vite-resolve-tsconfig-paths')
The package is ESM-only; CommonJS require will fail. Use import syntax.
viteResolveTsconfigPaths
import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'
import viteResolveTsconfigPaths from 'vite-resolve-tsconfig-paths'
There is no default export; the only exported symbol is 'tsConfigPaths'. The alternative name 'viteResolveTsconfigPaths' is not provided.
default
import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'
import viteResolveTsconfigPaths from 'vite-resolve-tsconfig-paths'
The module does not have a default export. Always use named import for tsConfigPaths.

Shows how to install and use vite-resolve-tsconfig-paths in a Vite project with TypeScript.

// Install: npm install -D vite-resolve-tsconfig-paths // vite.config.ts import { defineConfig } from 'vite'; import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'; export default defineConfig({ plugins: [tsConfigPaths()] }); // Ensure your tsconfig.json has paths configured, e.g.: // { // "compilerOptions": { // "baseUrl": ".", // "paths": { // "@/*": ["src/*"] // } // } // }
Debug
Known issues
gotchaThe plugin is ESM-only; using require() will throw an error.
fix
Convert to ESM by using import syntax or setting type: 'module' in package.json.
affects: >=0.0.0
gotchaThe plugin only exports a single named export: tsConfigPaths. Importing default or other names will fail.
fix
Use import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'.
affects: >=0.0.0
gotchaThe plugin will not resolve paths if tsconfig.json does not exist or is misconfigured.
fix
Ensure a valid tsconfig.json with 'compilerOptions.paths' exists in the project root.
affects: >=0.0.0
gotchaThe plugin is in early development (v0.0.x); API may change without notice.
fix
Pin the exact version in package.json and test upgrades carefully.
affects: <1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported.
The package is ESM-only and cannot be required with require().
fix
Replace require('vite-resolve-tsconfig-paths') with import { tsConfigPaths } from 'vite-resolve-tsconfig-paths' and ensure your project uses ESM.
The requested module 'vite-resolve-tsconfig-paths' does not provide an export named 'default'
Trying to import a default export that does not exist.
fix
Change import to import { tsConfigPaths } from 'vite-resolve-tsconfig-paths'.
Cannot find module 'vite' or its corresponding type declarations.
Vite is a peer dependency and must be installed separately.
fix
Install Vite: npm install -D vite.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
viterequiredRequired as a peer dependency; the plugin is designed to work as a Vite plugin.
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
vite-resolve-tsconfig-paths — npm install vite-resolve-tsconfig-paths · libregistry