Registry / devops / vite-jsconfig-paths

vite-jsconfig-paths

JSON →
library2.0.1jsnpmunverified

Vite plugin that resolves imports using `jsconfig.json` path mappings, enabling JavaScript projects to use TypeScript-style alias resolution without a tsconfig.json. Version 2.0.1 is current, stable, and maintained. It mirrors the functionality of vite-tsconfig-paths but for JS-only projects. Supports baseUrl, include/exclude patterns, and custom extensions. Debug logging via DEBUG environment variable is available for troubleshooting. Active development with regular updates.

npm install vite-jsconfig-paths
INSTALL
IMPORT
SIG · VITE-JSCONFIG-PATH
V
vite-jsconfig-paths
devopsjavascriptv2.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

default
import jsconfigPaths from 'vite-jsconfig-paths'
const jsconfigPaths = require('vite-jsconfig-paths')
ESM-only package; CommonJS require is not supported. Use dynamic import if necessary.
jsconfigPaths
import jsconfigPaths from 'vite-jsconfig-paths'
import { jsconfigPaths } from 'vite-jsconfig-paths'
The package exports a single default function; named import is incorrect.
type imports
import type { Plugin } from 'vite'
This package does not export TypeScript types; use vite's Plugin type for type annotations.

Quickstart showing how to add the plugin to a Vite config file with default options.

// vite.config.js import { defineConfig } from 'vite' import jsconfigPaths from 'vite-jsconfig-paths' export default defineConfig({ plugins: [jsconfigPaths()] })
Debug
Known issues
gotchaRestart Vite after updating jsconfig.json paths mappings for changes to take effect.
fix
Manually restart the Vite dev server or rebuild.
affects: >=2.0.0
breakingDropped support for vite 1.x; requires vite >2.0.0-0.
fix
Upgrade Vite to version >2.0.0-0 or use vite-jsconfig-paths@1.x.
affects: >=2.0.0
gotchabaseUrl resolution may accidentally resolve to files outside project root, potentially causing unexpected behavior.
fix
Ensure baseUrl is set carefully and relative to project root.
affects: >=1.0.0
deprecatedDebug logging via DEBUG environment variable is supported but may be removed in future versions.
fix
Use built-in Vite debug logging or plugin-specific options if available.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-jsconfig-paths'
Package not installed or incorrect import path.
fix
Run npm install vite-jsconfig-paths --save-dev and ensure import is from 'vite-jsconfig-paths'.
SyntaxError: Unexpected token 'export'
Using CommonJS require with ESM-only package.
fix
Change to ESM import syntax or use dynamic import: const jsconfigPaths = (await import('vite-jsconfig-paths')).default;
TypeError: jsconfigPaths is not a function
Attempted named import instead of default import.
fix
Use default import: import jsconfigPaths from 'vite-jsconfig-paths'
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies
viterequiredPeer dependency; plugin requires Vite >2.0.0-0 to function.
Agent activity
2 hits · last 30 days
node
2
Resources
vite-jsconfig-paths — npm install vite-jsconfig-paths · libregistry