javascript - Hur man kompilerar typescript med strikta minnesgränser


Jag försöker distribuera ett litet Typescript-projekt på en hobbyist-instans på Heroku men mitt byggsteg misslyckas med FATAL ERROR: Ineffective mark-compacts near heap

Vilka är några användbara minnesoptimeringar (både i koden och i min tsconfig) som jag kan använda för att bygga den här saken med 512 MB minne?

Mitt build-kommando och tsconfig är som följer:

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"
  }
}

Relaterade artiklar