1

In my .jsx module I get this error

Unable to resolve path to module

How can I fix it? The imported module exist.

Screenshot of Sublime showing the code and error messahe

I use eslint-plugin-import, github issue here

try-catch-finally
  • 7,436
  • 6
  • 46
  • 67
VelikiiNehochuha
  • 3,775
  • 2
  • 15
  • 32

1 Answers1

0

It might be that eslint-import doesn't automatically include the .jsx extension. You can try this:

Add to your .eslintrc:

"settings": {
  "import/extensions": [".js", ".jsx"]
}

If just that doesn't help, try to add eslint-import-resolver-webpack as a devDependency.

npm i -D eslint-import-resolver-webpack

And include it in the .eslintrc settings:

"settings": {
  "import/resolver": "webpack",
  "import/extensions": [".js", ".jsx"]
}

You may need to configure the "module roots" in webpack:

resolve: {
  modules: ['app', 'node_modules']
}

You might need to replace modules by root in webpack 1.x.

If it still don't work (and it does in command line), it might be a sublime linter issue: https://www.npmjs.com/package/eslint-plugin-import#sublimelinter-eslint

publicJorn
  • 2,404
  • 1
  • 20
  • 30