Etc.

[ESLint] Unable to resolve path to module

Olivia Kim 2023. 8. 1. 19:54
반응형

 

오류 발생 경로

React + TypeScript 프로젝트에 eslint, prettier를 적용하던 중 src 하위에 파일 경로가 제대로 있음에도 다음과 같은 에러가 발생했다.

 

 

 


오류 내역

Unable to resolve path to module

 

 

 


오류 원인 및 해결 방법

 

    "settings": {
        "import/resolver": {
            "node": {
                "extensions": [".js", ".jsx", ".ts", ".tsx"]
            }
        }
    }

 

.eslintrc.js 파일에 위와 같은 구문을 추가한다.

 

 

 

이후 .eslintrc.js 파일을 저장해보면 이전과 같은 파일임에도 불구하고 에러가 나지 않는 것을 확인할 수 있다.

 

 

 


[참고 자료]

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

 

Using eslint with typescript - Unable to resolve path to module

I have this import in my file app.spec.ts: import app from './app'; Which causes this Typescript error 2:17 error Unable to resolve path to module './app' import/no-unresolved ./app.ts does ex...

stackoverflow.com

 

 

 

반응형