How to compile typescript with strict memory limits

Viewed 248

I'm trying to deploy a small Typescript project on a hobbyist Heroku instance but my build step fails with FATAL ERROR: Ineffective mark-compacts near heap

What are some useful memory optimizations (both in code and in my tsconfig) that I can use to build this thing with 512mb of memory?

My build command and tsconfig are as follows:

tsc && node --optimize_for_size --max_old_space_size=460 dist/main.js

{
  "compilerOptions": {
    "target": "ES2019",
    "module": "CommonJS",
    "strict": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictPropertyInitialization": false,
    "removeComments": true,
    "incremental": true,
    "sourceMap": false,
    "declaration": false,
    "outDir": "./dist"
  }
}
0 Answers
Related