Registry / devops / eslint-import-resolver-vite

eslint-import-resolver-vite

JSON →
library2.1.1jsnpmunverified

Vite module resolution plugin for eslint-plugin-import and eslint-plugin-import-x (resolver interface v3). Current stable version v2.1.1 (released 2025-04). Supports ESM, CJS, and mixed setups. Handles `resolve.alias` from Vite config. Critically, v2.x requires users to provide the config object explicitly, avoiding require() issues in mixed setups. Active development. Key differentiator: lightweight alternative to eslint-import-resolver-typescript when using Vite's alias feature.

devops
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default export works as a resolver for eslint-plugin-import settings

import resolver from 'eslint-import-resolver-vite'

Named export for eslint-plugin-import-x resolver interface v3

import { createViteImportResolver } from 'eslint-import-resolver-vite'

TypeScript type for the resolver config object

import type { ResolverConfig } from 'eslint-import-resolver-vite'

Setup eslint-import-resolver-vite with a Vite alias config and use it in ESLint settings.

// vite.config.ts export const viteConfigObj = { resolve: { alias: { _: path.resolve(__dirname, 'src') } } }; // .eslintrc.cjs module.exports = { settings: { 'import/resolver': { vite: { viteConfig: require('./vite.config').viteConfigObj } } } };
Debug
Known footguns
breakingIn v2.0.0, the resolver no longer loads the Vite config automatically. You must pass `viteConfig` explicitly.
gotchaMixing ESM and CJS may cause issues when importing the Vite config if it's ESM and you use `require()`. Use dynamic import or provide config as plain object.
gotchaThe resolver only handles `resolve.alias`; it does not handle Vite plugins or other resolve options.
deprecatedFor `eslint-plugin-import-x` resolver interface v2 (deprecated), use default export. For v3, use `createViteImportResolver`.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources