From 1871eacea0c9210f3dcd23cfb471d4195fa5528d Mon Sep 17 00:00:00 2001 From: tauagent <259104564+tauagent@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:19:09 +0000 Subject: [PATCH] fix: use process.cwd() for package.json path in version.ts __dirname resolves differently when bundled with tsup, causing the Docker image to fail with ENOENT for /app/dist/package.json. Using process.cwd() instead, which reliably resolves to /app in Docker. --- src/version.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/version.ts b/src/version.ts index 0dda36fd..094f35ef 100644 --- a/src/version.ts +++ b/src/version.ts @@ -3,8 +3,10 @@ import { join } from 'path' // Read version from package.json at startup. Using readFileSync since this // runs once at import time, not per-request. +// Use process.cwd() instead of __dirname since bundlers like tsup change +// __dirname resolution, but cwd is reliably /app in Docker. const pkg = JSON.parse( - readFileSync(join(__dirname, '../package.json'), 'utf-8') + readFileSync(join(process.cwd(), 'package.json'), 'utf-8') ) export const version: string = pkg.version