티스토리 뷰
반응형

Typescript를 사용하는 프로젝트를 만들때 기본적으로 사용하는 CompilerOptions 를 아래와 같이 정리해보았다.
{
"compilerOptions": {
// 컴파일된 JavaScript의 버전. ES6로 설정하여 ES6 문법을 사용
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// JSX를 React로 변환하도록 설정
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
// 모듈 시스템을 ESNext로 설정. 최신 ES 모듈 시스템을 사용
"module": "ESNext" /* Specify what module code is generated. */,
// 소스 맵을 생성하여 디버깅 시 원본 코드와 매핑할 수 있도록 설정
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// 컴파일된 파일의 출력 디렉토리 설정
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
// CommonJS 모듈과의 호환성을 위해 ES 모듈 가져오기를 활성화
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// 파일 이름의 대소문자를 일관되게 강제
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
// 엄격한 타입 검사를 활성화. 모든 검사 규칙을 활성화
"strict": true /* Enable all strict type-checking options. */,
// 라이브러리 파일의 타입 체크를 건너뜁니다. 빌드 시간을 단축
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
// 모듈 해석 전략을 Node.js 스타일로 설정
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
// 'src' 디렉토리를 baseUrl로 설정
"baseUrl": "./src" /* Specify the base directory to resolve non-relative module names. */,
// '@'를 'src' 디렉토리와 매핑
"paths": {
"@/*": ["*"]
}
"include": ["src/**/*"], // 컴파일할 파일이 포함된 경로
"exclude": ["node_modules", "dist"] // 컴파일에서 제외할 경로
}
반응형
'Javascript와 Typescript' 카테고리의 다른 글
window.d.ts란 무엇일까? (0) | 2024.11.18 |
---|---|
ENUM vs. const (0) | 2024.11.15 |
Recoil Atom의 타입 지정 (0) | 2024.11.09 |
Vimeo에 동영상 업로드하기 (1) | 2024.11.08 |
console.error와 console.assert (0) | 2024.11.06 |
- Total
- Today
- Yesterday
반응형