참고
tsconfig.json 예시
{
"compilerOptions": {
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "dist", /* Redirect output structure to the directory. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": ".", /* Base directory to resolve non-absolute module names. */
"paths": {
"@common/*": ["src/common/*"],
"@internal/*": ["src/internal/*"],
"@api/*": ["src/server/api/*"],
"@dto/*": ["src/server/dto/*"],
"@/*": ["src/*"],
"*": [
"node_modules/*"
],
},
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": [
"src/**/*"
],
"exclude": [
"tests"
]
}
npm 패키지 설치
npm install --save-dev tsconfig-paths
package.json: ts-node 실행 명령어 수정
env-cmd -f .env.local nodemon --ignore tests/ --watch src -e ts,tsx --exec ts-node **-r tsconfig-paths/register** src/app.ts