If I use
"settings": {
"import/resolver": "webpack"
}
as my settings and my webpack config file is webpack.config.js everything works.
But if I try to do
"settings": {
"import/resolver": {
"config": "webpack.config.dev.js"
}
}
and rename my webpack config file name to webpack.config.dev.js.
I get this error when I'm linting
Resolve error: unable to load resolver "config"
I'm using
2.6.12.6.00.8.3What if the path starts with ./? node's require algorithm requires all relative paths start with a dot.
Doesn't work either.
Similarly, mine fails if my webpack config is in a subdirectory, such as ./config/webpack.config.js. An error is thrown before linting occurs _(paths anonymized below)_:
Error: Cannot find module '.../node_modules/.../some-depenency/config/webpack.config.common.js'
you need to wrap it within the webpack object 馃槃
"settings": {
"import/resolver": {
"webpack": {
"config": "./webpack.config.web.dev.js"
}
}
}
This solved it! I missed that. Thanks @kossel.
Most helpful comment
you need to wrap it within the
webpackobject 馃槃