From ba409ca53bdaa02ab3db4df9028673815ad980a3 Mon Sep 17 00:00:00 2001 From: Devil Date: Tue, 11 Aug 2026 16:10:44 +0200 Subject: [PATCH] fix(backend): compiled output was nested under dist/src, not dist/ api container crashed on boot: Cannot find module '/app/dist/main.js'. Root cause: tsconfig.json had no rootDir, and prisma/make-admin.ts (run separately via ts-node, never part of the Nest build) was swept into the nest build compilation since there was no exclude either - so tsc inferred the output root as the project root and nested everything under dist/src/ instead of the flat dist/main.js the Dockerfile, package.json scripts, and compose's worker command all assume. Also excludes tsconfig.tsbuildinfo from the Docker build context - a stale local incremental-build cache file was leaking in via `COPY . .` (only dist/node_modules were dockerignored) and made nest build skip emitting .js files entirely on a from-scratch container build once the rootDir fix invalidated its cached signature. --- .gitignore | 1 + backend/.dockerignore | 1 + backend/tsconfig.json | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3c60034..6d71b3f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules/ # Build output backend/dist/ +backend/tsconfig.tsbuildinfo frontend/.next/ frontend/tsconfig.tsbuildinfo diff --git a/backend/.dockerignore b/backend/.dockerignore index b6297c2..0705bb8 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1,5 +1,6 @@ node_modules dist +tsconfig.tsbuildinfo .env .env.development .env.production diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 4b82434..3f4e94e 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -9,6 +9,7 @@ "target": "ES2021", "sourceMap": true, "outDir": "./dist", + "rootDir": "./src", "baseUrl": "./", "incremental": true, "skipLibCheck": true, @@ -17,5 +18,6 @@ "strictBindCallApply": false, "forceConsistentCasingInFileNames": false, "noFallthroughCasesInSwitch": false - } + }, + "exclude": ["node_modules", "dist", "prisma"] }