diff --git a/build.ts b/build.ts index 895b809..f954bc5 100644 --- a/build.ts +++ b/build.ts @@ -15,6 +15,10 @@ import logger from "jet-logger"; await remove("./dist/"); // Copy back-end files await exec("tsc --build tsconfig.prod.json && npx tsc-alias -p tsconfig.prod.json", "./"); + // Verify production entrypoint exists to prevent deploy startup crashes + if (!fs.existsSync("./dist/index.js")) { + throw new Error("Build Error: dist/index.js was not generated. Check compilerOptions.rootDir configuration!"); + } } catch (err) { logger.err(err); process.exit(1); diff --git a/tsconfig.prod.json b/tsconfig.prod.json index 07e12cf..b6b615e 100644 --- a/tsconfig.prod.json +++ b/tsconfig.prod.json @@ -2,7 +2,8 @@ "extends": "./tsconfig.json", "compilerOptions": { "sourceMap": false, - "removeComments": true + "removeComments": true, + "rootDir": "./src" }, "exclude": [ "spec",