Skip to content
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 + ESLint: "unable to resolve path to module .." (import/no-unresolved) #1419

Closed
boschr opened this issue Jul 27, 2017 · 5 comments
Closed

Comments

@boschr
Copy link

boschr commented Jul 27, 2017

I'm getting a lot of "unable to resolve path to module .." errors when Hound lints my code. After invest a lot of time to resolve this error without any luck, i hope anybody else has an idea how to resolve this. Are there more people who experience this?

Currently i'm working in a ruby 2.4.1 with rails 5.0.4 environment and I'm using webpack to compile my javascript. I read a lot about the "eslint-import-resolver-webpack" to solve this problem. Locally ESLint with the webpack resolver works fine with my Editor (VS Code) and via the CLI.

I'm using the following versions:

"dependencies": {
  ..  
  "webpack": "^3.3.0",
},
"devDependencies": {
  "eslint": "^4.2.0",
  "eslint-config-airbnb-base": "^11.2.0",
  "eslint-plugin-import": "^2.7.0",
  "eslint-import-resolver-webpack": "^0.8.3",
  ..
}

with this .eslintrc.yml configuration:

settings:
  import/resolver:
    webpack:
      config: 'config/webpack/development.js'

and the following webpack alias resolver:

resolve: {
  ...
  alias: {
    assets: resolve('app/assets'),
    javascript: resolve(settings.source_path),
  },
},
@lzhuor
Copy link

lzhuor commented Sep 12, 2017

Having the same issue after upgrading eslint-plugin-import from 2.3.0 to 2.7.0

@gylaz
Copy link
Member

gylaz commented Sep 12, 2017

Since Hound doesn't install the extensions and packages locally, the path cannot be resolved. We recommend disabling this rule in your .eslintrc via "import/extensions": "off" or "import/no-unresolved": "off".

lkvposs added a commit to apartmentlist/style that referenced this issue Apr 24, 2018
changes as [suggested by hound maintainer](houndci/hound#1419)
ozimos added a commit to ozimos/Book-A-Meal that referenced this issue Apr 29, 2018
changes as [suggested by hound maintainer](houndci/hound#1419)
@b-asaf
Copy link

b-asaf commented Oct 16, 2018

I found this answer in stack overflow for ESLint

@vianneyguesdon
Copy link

Solved here for TS :
https://stackoverflow.com/questions/55198502/using-eslint-with-typescript-unable-to-resolve-path-to-module

@joeheyming
Copy link

I solved this issue by editing my tsconfig.json and adding:

//...
paths: {
 // ...your paths
 "federated-module": ["path/to/federated-module.d.ts"]
}

also in eslintrc:

{
  settings: {
    'import/resolver': {
      typescript: {
        alwaysTryTypes: true
      }
    }
  } 
}

inside my federated-module.d.ts, it had the declare module, etc for the missing types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants