Registry / devops / eslint-plugin-import-exports-imports-resolver

eslint-plugin-import-exports-imports-resolver

JSON →
library1.0.1jsnpmunverified

A custom resolver for eslint-plugin-import that resolves package exports and imports defined in the exports and imports fields of package.json. Version 1.0.1 is the only published version. It eliminates false positives for import/no-unresolved when using package.json exports and imports (e.g., #imports or subpath exports). Different from the default node resolver, which does not support these fields. Supports aliases and custom module directories. Works with both CJS and ESM configs, but requires eslint-plugin-import to be installed. No known alternative resolvers for this specific use case.

npm install eslint-plugin-import-exports-imports-resolver
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-IMPO
E
eslint-plugin-import-exports-imports-resolver
devopsjavascriptv1.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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

(default)
const resolver = require('eslint-plugin-import-exports-imports-resolver');
import resolver from 'eslint-plugin-import-exports-imports-resolver';
This package is CJS-only, so require() is correct. ESM import may fail or require special handling.
required path
'./node_modules/eslint-plugin-import-exports-imports-resolver/index.js'
'eslint-plugin-import-exports-imports-resolver'
In JSON config, you must use the full path to index.js, not the package name, because settings.import/resolver expects a module path.
require.resolve usage
require.resolve('eslint-plugin-import-exports-imports-resolver')
require('eslint-plugin-import-exports-imports-resolver')
In JS config, use require.resolve() to get the absolute path. Using require() directly may work but is less reliable.

Configures the resolver in a .eslintrc.js file with an alias and custom module directories, enabling resolution of package imports and exports.

// .eslintrc.js module.exports = { settings: { 'import/resolver': { [require.resolve('eslint-plugin-import-exports-imports-resolver')]: { alias: { 'my-alias': 'my-alias-v2' }, node: { moduleDirectory: ['node_modules', 'bower_components'] } }, }, }, rules: { 'import/no-unresolved': 'error', }, }; // Then in your source files: import { foo } from '#local'; // resolves via imports field import { bar } from 'pkg/subpath'; // resolves via exports field
Debug
Known issues
gotchaJSON config requires full path to index.js, not package name.
fix
Use './node_modules/eslint-plugin-import-exports-imports-resolver/index.js' instead of the package name.
affects: >=1.0.1
gotchaPackage is CJS-only; ESM imports may not work.
fix
Use require() instead of import.
affects: >=1.0.1
gotchaMust have eslint-plugin-import installed and configured.
fix
Install eslint-plugin-import and configure it with import/no-unresolved rule enabled.
affects: >=1.0.1
gotchaAlias configuration requires exact path matching; wildcards not supported.
fix
Use explicit alias mappings, e.g., 'project-foo' -> 'project-foo-v1'.
affects: >=1.0.1
Errors
Common errors & fixes
Unable to resolve path to module 'eslint-plugin-import-exports-imports-resolver'
In JSON config, the package name is used instead of the full path to index.js.
fix
Replace 'eslint-plugin-import-exports-imports-resolver' with './node_modules/eslint-plugin-import-exports-imports-resolver/index.js' in settings.import/resolver.
Cannot find module 'eslint-plugin-import'
eslint-plugin-import is not installed.
fix
Run 'npm install eslint-plugin-import --save-dev'.
Expected 'import/resolver' to be an object, got undefined
settings.import is not defined in ESLint config.
fix
Add a settings object with 'import' key: settings: { 'import': { resolver: { ... } } }.
import/no-unresolved: Unable to resolve path to module '#foo'
The 'imports' field in package.json is missing or incorrectly configured.
fix
Ensure your package.json has an 'imports' field mapping '#foo' to a valid path, e.g., { "imports": { "#foo": "./bar.js" } }.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
eslint-plugin-importrequiredThis is a resolver plugin for eslint-plugin-import and requires it to be installed and configured.
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-import-exports-imports-resolver — npm install eslint-plugin-import-exports-imports-resolver · libregistry