diff --git a/package.json b/package.json index 2d06c70..595169a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "watch": "ng build --watch --configuration development", "test": "jest", "serve:ssr": "node scripts/serve-ssr.js", - "build:ssr": "bun run build:prod && ng run goals-tracker:server:production", + "build:ssr": "bun run build:prod", "prerender": "ng run goals-tracker:prerender" }, "private": true, diff --git a/scripts/build-with-env.js b/scripts/build-with-env.js index eb76f6f..f5f5c40 100644 --- a/scripts/build-with-env.js +++ b/scripts/build-with-env.js @@ -1,8 +1,11 @@ #!/usr/bin/env node /** - * Loads .env and runs ng build. + * Loads .env and runs ng build + server build. * Use for production build so process.env is populated for environment.prod.ts. */ require('dotenv').config(); const { execSync } = require('child_process'); -execSync('ng build', { stdio: 'inherit' }); +const { join } = require('path'); +const ngPath = join(process.cwd(), 'node_modules', '.bin', 'ng'); +execSync(`"${ngPath}" build`, { stdio: 'inherit' }); +execSync(`"${ngPath}" run goals-tracker:server:production`, { stdio: 'inherit' });