From a104caf147fec1355dc7e81757f89e7cbaae939c Mon Sep 17 00:00:00 2001 From: Tony Casey Date: Mon, 18 Aug 2025 17:41:02 +0100 Subject: [PATCH] Fix Heroku deployment: separate production TypeScript config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create tsconfig.prod.json for production builds without Jest types - Update build script to use production config - Excludes all test files and mock directories from production build - Fixes "Cannot find type definition file for 'jest'" error on Heroku The production config extends the base tsconfig but overrides the types array to exclude Jest, which is only in devDependencies. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- backend/package.json | 2 +- backend/tsconfig.prod.json | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 backend/tsconfig.prod.json diff --git a/backend/package.json b/backend/package.json index 14d489c..d46f7a1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "scripts": { "dev": "nodemon --exec ts-node src/server.ts", - "build": "tsc --skipLibCheck --noImplicitAny false", + "build": "tsc -p tsconfig.prod.json --skipLibCheck --noImplicitAny false", "start": "node dist/index.js", "test": "jest", "test:watch": "jest --watch", diff --git a/backend/tsconfig.prod.json b/backend/tsconfig.prod.json new file mode 100644 index 0000000..ced6a48 --- /dev/null +++ b/backend/tsconfig.prod.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "types": ["node"] + }, + "exclude": [ + "node_modules", + "dist", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/test/**/*", + "src/**/__mocks__/**/*", + "src/**/__tests__/**/*", + "jest.config.js" + ] +} \ No newline at end of file