Avoiding out of memory errors with tsc (TypeScript Compiler)


So the other day while working (on my Mac) on a plugin I was using tsc -w and after every second compilation tsc would exit with an out of memory error.

This can be fixed by enlarging node’s heap. The best way I could find was this global fix that changes the heap from the default (1.7 GB?) to 4GB:

Open this file:

vi /usr/local/bin/tsc

Change its contents to:

#!/usr/bin/env node --max-old-space-size=4096

Now tsc -w works forever and ever!


It was already set to that on my Mac. :thinking:


Including the max-old-space-size setting?


Ah, not that part. my bad :sweat_smile:

changes made :slight_smile: