I have an express.js project (typescript) with the following commands to package.json
"scripts": {
"start": "npm run build && npm run watch",
"build": "npm run build-ts && npm run tslint",
"serve": "nodemon dist/server.js",
"watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve\"",
"test": "jest --forceExit",
"build-ts": "tsc",
"watch-ts": "tsc -w",
"tslint": "tslint -c tslint.json -p tsconfig.json",
"debug": "npm run build && npm run watch-debug",
"serve-debug": "nodemon --inspect dist/server.js",
"watch-debug": "concurrently -k -p \"[{name}]\" -n \"Sass,TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve-debug\"",
"angular-build": "cd app && ng build --prod --output-path=../dist/app/ --deploy-url= --no-progress --aot true"
},
I know that the command to increase heap memory size is --max-old-space-size but i don't know where to put it....
All the examples i saw are
node --max-old-space-size=4096 myapp.js
but I don't run my app this way... I just run "npm start"
I use this code to check the current heap size
let v8 = require("v8");
let totalHeapSizeInGB = (((v8.getHeapStatistics().total_available_size) / 1024 / 1024 / 1024).toFixed(2));
console.log(`*******************************************`);
console.log(`Total Heap Size ~${totalHeapSizeInGB}GB`);
console.log(`*******************************************`);
nodemon --max-old-space-size=4096 dist/server.js (this is OK)
nodemon dist/server.js --max-old-space-size=4096 (this is NOT OK)