fix: use tsc directly instead of nest build to resolve path aliases
Some checks failed
CI/CD Pipeline / Integration Tests (push) Blocked by required conditions
CI/CD Pipeline / Deployment Summary (push) Blocked by required conditions
CI/CD Pipeline / Backend - Build, Test & Push (push) Failing after 2m11s
CI/CD Pipeline / Frontend - Build, Test & Push (push) Has been cancelled

- Changed build script from `nest build` to `tsc -p tsconfig.build.json`
- This ensures TypeScript path aliases (@domain/*, @application/*, @infrastructure/*) are properly resolved during compilation
- tsc-alias then converts the resolved paths to relative imports in the output
- Reverted tsconfig.json to original baseUrl: "./" configuration
- Added explicit path aliases to tsconfig.build.json for clarity

Root cause: NestJS's `nest build` command doesn't fully support TypeScript path aliases out of the box. Using `tsc` directly ensures proper path resolution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David 2025-11-17 01:41:28 +01:00
parent e1e9b605cc
commit a0863d19ac
4 changed files with 17 additions and 6 deletions

View File

@ -6,6 +6,8 @@
"deleteOutDir": true, "deleteOutDir": true,
"webpack": false, "webpack": false,
"tsConfigPath": "tsconfig.build.json", "tsConfigPath": "tsconfig.build.json",
"plugins": ["@nestjs/swagger"] "plugins": ["@nestjs/swagger"],
"assets": [],
"watchAssets": false
} }
} }

View File

@ -4,7 +4,8 @@
"description": "Xpeditis Backend API - Maritime Freight Booking Platform", "description": "Xpeditis Backend API - Maritime Freight Booking Platform",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "nest build && tsc-alias", "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
"build:nest": "nest build && tsc-alias",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start", "start": "nest start",
"dev": "nest start --watch", "dev": "nest start --watch",

View File

@ -1,4 +1,12 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@domain/*": ["src/domain/*"],
"@application/*": ["src/application/*"],
"@infrastructure/*": ["src/infrastructure/*"]
}
},
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"] "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
} }

View File

@ -9,7 +9,7 @@
"target": "ES2021", "target": "ES2021",
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",
"baseUrl": "./src", "baseUrl": "./",
"incremental": true, "incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"strictNullChecks": true, "strictNullChecks": true,
@ -23,9 +23,9 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true, "esModuleInterop": true,
"paths": { "paths": {
"@domain/*": ["domain/*"], "@domain/*": ["src/domain/*"],
"@application/*": ["application/*"], "@application/*": ["src/application/*"],
"@infrastructure/*": ["infrastructure/*"] "@infrastructure/*": ["src/infrastructure/*"]
} }
}, },
"include": ["src/**/*"], "include": ["src/**/*"],