본문 바로가기
IT/React

'index.tsx' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.ts(1208)

by 골든크랩 2023. 1. 10.
728x90
반응형

index.tsx 파일을 만들어 아래와 같이 했더니 function 아래 붉은줄이 그어지면 나타난 에러...

function TodoInput() {
  return <></>;
}
 

export default 를 넣으니 사라짐.

 

export default function TodoInput() {
  return <></>;
}

 

그러나 return 문 뒤 꺽쇠에 다시 붉은 줄..

'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.ts(26

tsconfig.json 파일에 

"jsx" : "react"  이렇게 되어 있던 것을

"jsx" : "react-jsx" 로 변경하니 해결됨

 

 

 

728x90
반응형

댓글