-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack resolver: config not used if config file requires transpilation #799
Comments
Hello ! Since I updated from 2.2.1 to 2.3.3, i can't resolve any package from custom paths.
Nothing in app/node_modules is resolved unfortunately. |
Same here, I just updated from webpack v1 to latest v2 (2.4.1) and the webpack resolver stopped working. In webpack.config.js:
|
Same here. Worked fine with Webpack 1.14.0. Upgraded to Webpack 2.5.1 and the webpack-resolver no longer works. boo. |
updated to webpack 2.6.1 and resolver stopped working .eslintrc "settings": {
"import/resolver": {
"webpack": {
"config": "webpack.common.config.js"
}
}
} webpack.common.config.js resolve: {
extensions: ['.js', '.jsx'],
alias: {
containers: path.resolve(ROOT_PATH, './src/containers'),
components: path.resolve(ROOT_PATH, './src/components'),
sections: path.resolve(ROOT_PATH, './src/components/ContainerSections'),
'redux-base': path.resolve(ROOT_PATH, './src/redux-base'),
utils: path.resolve(ROOT_PATH, './src/utils'),
common: path.resolve(ROOT_PATH, './src/common'),
routes: path.resolve(ROOT_PATH, './src/routes'),
config: path.resolve(ROOT_PATH, './src/config'),
static: path.resolve(ROOT_PATH, './static'),
styles: path.resolve(ROOT_PATH, './src/styles'),
},
} |
Similar config as @vorlov and my resolver is not working either. |
"+1s" aren't helpful; please avoid cluttering up issues and instead, react with an emoji on the original post. I'll now delete the +1s. |
any movement/workaround to this issue? every file in my app fails due to this :(
|
@bradennapier the only workaround is to disable these rules in |
Mine doesn't work earlier either, and I found out the issue to be I used ES6 syntax HTH. |
Same as @zhenyulin, my webpack config was not used at all. "settings": {
"import/parser": "babel-eslint",
"import/resolver": {
"webpack": {
"config": "./tools/webpack.config.js"
}
}, |
@r1m: great point! the resolver only transpiles the config if it is named |
others: webpack 2/3 is supported (I'm using Webpack v3 with an ancient version of the plugin and it works fine) but as @r1m mentioned, if the resolver can't load the config because it has syntax not supported by your local Node version, it won't work unless you rename your config to Does anyone have a reference to Webpack docs that describe whether/how it supports non-native syntax in config? |
I'm not directly using webpack-cli but using the API, that why I can use Maybe a new feature : add a warning when this plugin cannot read the configFile provided :) |
You can also transpile webpack config from es6 to es5 on the fly with babel-register my package.json
.eslintrc.json
build/webpack.eslint.conf.js
|
or you can just name it |
The problem right now is that the plugin is failing silently to parse the config. Solutions exist but it's hard to find the cause in the first place : the only symptom is that eslint will not resolve imports. The fix would be to document it properly or add a console warning when eslint is loading (don't know if possible) |
Some sort of warning or error seems reasonable; I'd be in favor of a hard failure when a config exists but fails to parse. |
@qawsqs should be the accepted answer (@ljharb is also great if you have the context of the previous answer) |
I confirm UPDATE: issue can be probably closed as https://www.npmjs.com/package/eslint-import-resolver-webpack solved the problem for me |
Seems like #799 (comment) and eslint-import-resolver-webpack are the solutions here. |
Hi everyone,
I get a lot of no-unresolved errors when using this with webpack 2.3.3.
Plugins:
Webpack resolve config:
Eslintrc:
The text was updated successfully, but these errors were encountered: