Registry / eslint-import-resolver-babel-module

eslint-import-resolver-babel-module

JSON →
library5.3.2jsnpmunverified

A resolver for eslint-plugin-import that uses babel-plugin-module-resolver's alias configuration to resolve module paths. Version 5.3.2 is the current stable release, compatible with @babel/core ^7.0.0-0 and babel-plugin-module-resolver ^3.0.0 || ^4.0.0 || ^5.0.0. It allows ESLint to understand custom module aliases defined in Babel config, preventing false positive import/no-unresolved errors. Unlike eslint-import-resolver-alias or eslint-import-resolver-webpack, it integrates directly with Babel's module resolution, making it ideal for projects using babel-plugin-module-resolver. The package is actively maintained, with updates tracking eslint-plugin-import and babel-plugin-module-resolver releases.

npm install eslint-import-resolver-babel-module
INSTALL
IMPORT
SIG · ESLINT-IMPORT-RESO
E
eslint-import-resolver-babel-module
javascriptv5.3.2
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default (resolve function)
module.exports = { interfaceVersion: 2, resolve: (source, file, config) => { ... } }
import { resolve } from 'eslint-import-resolver-babel-module'
CommonJS module exports a resolve function; not a named export. Use require() in ESLint config.
(ESLint config import)
{"settings": {"import/resolver": {"babel-module": {}}}}
{"settings": {"import/resolver": "babel-module"}}
The resolver must be specified as an object, not a string. ESLint passes options to the resolver.
(TypeScript types)
// No TypeScript types provided; use @types/eslint-plugin-import if needed
import { Resolver } from 'eslint-import-resolver-babel-module'
This package does not ship TypeScript definitions. Rely on @types/eslint-plugin-import for resolver types.

Installs required packages, sets up Babel aliases, and configures ESLint to resolve those aliases.

// Install dependencies npm install --save-dev eslint eslint-plugin-import eslint-import-resolver-babel-module @babel/core babel-plugin-module-resolver // Configure .babelrc with aliases { "plugins": [ ["module-resolver", { "root": ["./src"], "alias": { "@components": "./src/components", "@utils": "./src/utils" } }] ] } // Configure .eslintrc { "settings": { "import/resolver": { "babel-module": {} } } }
Debug
Known issues
breakingVersion 5.x requires babel-plugin-module-resolver ^3.0.0 || ^4.0.0 || ^5.0.0. Older versions may not be compatible.
fix
Update babel-plugin-module-resolver to ^3.0.0, ^4.0.0, or ^5.0.0.
affects: >=5.0.0 <6.0.0
breakingResolves only for Babel projects; if Babel config is missing, ESLint import resolution fails.
fix
Ensure @babel/core and babel-plugin-module-resolver are installed and configured in your project.
affects: >=1.0.0
gotchaThe resolver reads Babel configuration from the project root (babel.config.js, .babelrc, etc.). Nested configs may be ignored.
fix
Make sure your Babel config is in the root directory or use a project-level babel.config.js.
affects: >=5.0.0
deprecatedThe option 'allowExistingDirectories' is experimental. It may be removed in future versions.
fix
If you rely on this feature, check changelog before upgrading.
affects: >=5.0.0 <6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-module-resolver'
Missing peer dependency.
fix
Run: npm install --save-dev babel-plugin-module-resolver
Unable to resolve path to module '@components/Button' (eslintimport/no-unresolved)
Babel alias not recognized by ESLint.
fix
Ensure the resolver is configured correctly in .eslintrc: "import/resolver": { "babel-module": {} } and that the alias is defined in Babel config.
ESLint: 'import/resolver' setting must be an object
Using string value instead of object.
fix
Change to: {"settings": {"import/resolver": {"babel-module": {}}}}
Upgrade
Version history
5.3.2latest on npm
Audit
Dependencies
eslint-plugin-importrequiredThis resolver is used as a plugin for eslint-plugin-import; it must be installed and configured.
@babel/corerequiredRequired to read Babel configuration and resolve aliases defined via babel-plugin-module-resolver.
babel-plugin-module-resolverrequiredThe actual module resolution logic; this resolver uses its alias map to resolve imports.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-import-resolver-babel-module — npm install eslint-import-resolver-babel-module · libregistry