question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESLint: Unable to resolve path to module

See original GitHub issue

We have solution for absolute path, like this:

import MyComponent from 'src/components/MyComponent'

It is work fine for yarn start, but for yarn lint:

Unable to resolve path to module 'src/components/MyComponent'     import/no-unresolved

I have solution for my other project (no RSK) with WebStorm:

  1. project_dir - Mark Directory as > Resource Root

  2. yarn add eslint-import-resolver-webpack -D

  3. config/default.js

...
	resolve: {
		// We can now require('file') instead of require('file.jsx')
		extensions: ['', '.js', '.jsx', '.scss'],
		alias: {
			src: path.resolve(__dirname, '../src')
		}
	},
...

  1. .eslintrc.js

/* global __dirname */

const path = require('path');

...
	settings: {
		'import/resolver': {
			webpack: {
				config: path.join(__dirname, '/config', 'default.js')
			}
		}
	}
...

How to solve this issue for RSK? Please help me.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:23

github_iconTop GitHub Comments

1192reactions
comerccommented, Mar 18, 2017

“import/no-unresolved”: “off”

(as temporary solution)

225reactions
skubecommented, Nov 7, 2018

As @karanssj4 linked to, this seems to be fixed by adding the following to .eslintrc

  "settings": {
    "import/resolver": {
      "node": {
        "extensions": [".js", ".jsx", ".ts", ".tsx"]
      }
    }
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using eslint with typescript - Unable to resolve path to module
Show activity on this post. You can set the ESLint module import resolution by adding this snippet to your . eslintrc. json configuration...
Read more >
ESLint Unable to resolve path to module
Visual Studio 2022 shows errors for tsconfig paths when it's actually able to find them. ... Please fix these issues! ... Thanks for...
Read more >
eslint/eslint - Gitter
I'm trying to setup eslint-plugin-import but I can't make it work xD ... 6:8 error Unable to resolve path to module '~/components' import/no-unresolved....
Read more >
eslint-plugin-import Unable to resolve path to module
Module resolution. We often encounter the problem that the module cannot be resolved after introducing the eslint-plugin-import plugin.
Read more >
Can't resolve path alias : r/reactjs - Reddit
src/App.tsx 7:0-53 Module not found: Error: Can't resolve '$/features/counter/Counter' in '\frontend\src'. I added these to tsconfig.json
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found