-
typescript 세팅카테고리 없음 2024. 6. 24. 20:56
명령프롬프트 를 열고 mkdir (폴더이름)
cd 로 만든 폴더를 들어가서
1.npm init -y
2. tsc --init --rootDir ./src --outDir ./dist --esModuleInterop --module commonjs --strict true --allowJS true --checkJS true {
- --rootDir ./src
- 프로그램의 소스 파일이 들어가는 경로는 src 디렉토리입니다.
- --outDir ./dist
- 컴파일이 된 파일들이 들어가는 디렉토리는 dist 디렉토리입니다.
- --esModuleInterop
- CommonJS 방식의 모듈을 ES모듈 방식의 import 구문으로 가져올 수 있습니다!
}
3.package 에서 script 부분 다지우고
"scripts": {
"start": "tsc && node ./dist/index.js",
"build": "tsc --build",
"clean": "tsc --build --clean"
}, - --rootDir ./src