TypeScript 합시다

[TypeScript][ch4][TypeScript Compiler] compileOptions - outDir, outFile, rootDir

써치킴 2022. 2. 12. 04:56
"outFile": {
  "description": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.",
  "type": "string",
  "markdownDescription": "Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output.\n\nSee more: https://www.typescriptlang.org/tsconfig#outFile"
},
"outDir": {
  "description": "Specify an output folder for all emitted files.",
  "type": "string",
  "markdownDescription": "Specify an output folder for all emitted files.\n\nSee more: https://www.typescriptlang.org/tsconfig#outDir"
},
"rootDir": {
  "description": "Specify the root folder within your source files.",
  "type": "string",
  "markdownDescription": "Specify the root folder within your source files.\n\nSee more: https://www.typescriptlang.org/tsconfig#rootDir"
},

outFile

  • 하나의 파일로 합쳐서 컴파일 진행 후 반환
  • 모든 출력을 하나의 JavaScript 파일로 묶는 파일을 지정

rootDir 

  • 컴파일을 시작하는 루트 폴더(설정 안하면 자동으로 가장 상위 디렉토리 지정)
  • 컴파일을 시작 할 범위를 지정하는 root dir 경로 (default project 최상위 dir를 root로 함)
    • root의 하위 폴더의 ts파일을 찾아 컴파일함 (싸고 있는 폴더도 같이 구조화 시켜서 outDir 위치에 생성시킴)

outDir

  • 컴파일 후 생성되는 JavaScript 파일이 생성될 폴더명
  • 컴파일서 가져다 놓을 위치