Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- react
- leetcode
- cloud
- nodejs
- MAC
- OOP
- node.js
- frontend
- DART
- language
- etc
- mongodb
- 영어
- Algorithms
- CSS
- javascript
- Infra
- Chrome
- Datastructure
- flutter
- db
- java
- JSP
- database
- Git
- HTML
- typescript
- express
- English
- ReactJS
Archives
- Today
- Total
henry dev
Auto Import 본문
VS Code에서 React 개발을 할 때 component를 auto fix에서 import하지 못 하는 경우가 발생했다. 이를 해결하기 위해서는 프로젝트 root에서 "jsconfig.json" 파일을 생성한다. 그리고 아래와 같이 작성해주면 이후 auto fix에서 component를 import 할 수 있다.
{
"compilerOptions": {
"module": "commonjs",
"target": "es2016",
"jsx": "preserve",
"baseUrl": "./src",
"checkJs": true
},
"exclude": ["node_modules", "**/node_modules/*"]
}
참고로 위 옵션 중 "checkJs"를 true로 하면 객체의 property를 사용할 때 편집기 상에서 에러를 보여줄 수 있다. 하지만 실제로는 제대로 동작한다. 그래서 이 옵션을 명시를 하지 않아도 문제가 없었는데 대신 이러면 component를 사용할 때 import를 하지 않아도 에러로 인식하지 않기 때문에 auto fix를 사용할 수 없어진다는 문제가 다시 발생한다..
Comments