Avoiding out of memory errors with tsc (TypeScript Compiler)


#1

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
require('../lib/tsc.js')

Now tsc -w works forever and ever!


#2

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


#3

Including the max-old-space-size setting?


#4

Ah, not that part. my bad :sweat_smile:
Thanks!

changes made :slight_smile: