[TS] No inputs were found in config file

Yunhye Park·2024년 2월 1일
post-thumbnail
No inputs were found in config file 'tsconfig 경로'.
Specified 'include' paths were '["client/src"]'
and 'exclude' paths were '[]'.ts

발생 상황

서버를 추가하게 되면서 기존 리액트 작업을 client 폴더에 따로 분리했다. 그 과정에서 tsconfig에 "include": ["client/src"] 부분이 자동으로 생긴 후로 저 에러가 발생했다.

{
  "compilerOptions": {
	...
  },
  "include": ["client/src"],
}

관련 오류를 검색하니 아래 두 가지를 확인해보라고 했다.

1) "jsx": "react-jsx" 추가했는지
2) ts 파일 하나라도 export 했는지

나는 include 부분이 문제였던 거라 전혀 다른 이야기였다.

해결

은 간단했다.
include 된 것만 삭제하면 끝!

하지만 내가 궁금했던 건 include와 exclude가 뭐길래 오류가 발생하는 것인지다.

include / exclude

Include
Specifies an array of filenames or patterns to include in the program. These filenames are resolved relative to the directory containing the tsconfig.json file.

공식문서에 따르면, include에 포함되는 경로/파일 이름을 포함한다. 즉 전체 파일을 ts에서 js로 바꾸려는 게 아니라 일부만 포함하고 싶을 때 사용하는 듯하다.

나는 위에 적은 경로 외에도 js로 변환할 디렉터리가 있어서 include 옵션을 사용함으로써 오히려 에러가 지속되었다. 전체 파일을 다 변환할 거라면 딱히 작성하지 않아도 될 옵션이다.

Exclude
Specifies an array of filenames or patterns that should be skipped when resolving include.

include 한 경로/파일 중에 제외할 것을 작성한다. 아마 여러 파일 중에서 하나 둘을 제외할 때 적절할 듯하다.

profile
일단 해보는 편

0개의 댓글