jh.nrtv

[error] vercel배포중 Module not found: Can't resolve 'perf_hooks' ReactJS 본문

Error

[error] vercel배포중 Module not found: Can't resolve 'perf_hooks' ReactJS

wlgus3 2023. 7. 14. 00:02

Nextjs 와 TS로 작업한 프로젝트 배포중 

Module not found: Can't resolve 'perf_hooks' in '/vercel/path0/node_modules/typescript/lib' 라는 오류가 발생했다. 

 

perf_hooks라는 것은 내가 직접 import 하거나 사용한 hook이 아니기 때문에 해결하는 데에 애를 먹었다.

한참을 검색하던 중 아래의 링크 발견했다.

 

해결

 

 

Module not found: Can't resolve 'perf_hooks' ReactJS

I'm working on reactjs (17.0.1) (node v15.11.0) with typescript and I'm getting this warning message, any idea how solve it ? ./node_modules/typescript/lib/typescript.js Critical dependency: the r...

stackoverflow.com

 

아래와 같은 문구를 확인할 수 있었다. 

"I get the exact same 3 warnings when I import anything from typescript"

 

결론적으로 논쟁은 있으나 Typescript에서 무언가 import 할 때에 빌드는 성공하지만 위와 비슷한 오류를 뱉어낸다고 한다. 

 

나도 import {..} from 'typescript' 인 부분을 찾아서 지워주었고 해당 에러문구는 사라졌다.