import-js / import-js/eslint-plugin-import

Webpack resolver looks for custom webpack config in packages with jsnext:main

Open
#666 20 comments 21 reactions 0 assignees View on GitHub
bug enhancement help wanted package: resolver/webpack
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

With a `.eslintrc` like

```
"settings": {
"import/resolver": {
"webpack": {
"config": "webpack.karma.config.js"
}
}
},
```

when I import

```
import {takeEvery} from 'redux-saga';
```

I get the error

```
Cannot find module '/path/to/project/node_modules/redux-saga/webpack.karma.config.js
```

When I remove the `jsnext:main` entry from the `package.json` inside `node_modules/redux-saga`, the error goes away. So I guess the plugin is somehow trying to find a Webpack config inside `redux-saga` to load `resolve` configuration for ES6 files? This might be fine, looking for my custom Webpack config does not make sense, though.

Contributor guide

Open the contributing guide

Research direction

Start with the reported .eslintrc resolver configuration and the package.json containing jsnext:main, then reproduce the import of redux-saga. Trace how the webpack resolver chooses and loads webpack.karma.config.js; done means the resolver no longer searches for that config inside the dependency and the import succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.