title: How to set max-old-space-size for typescript compiler (tsc)?
body: <p>I have <code>tsc</code> job failing on gitlab ci with
  <code>FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory</code></p>
  <p>The script I'm running is
  <code>tsc -p test/tsconfig.json --noEmit</code></p>
  <p>What I've tried so far is to increase <code>max-old-space-size</code> via:</p>
  <ol>
  <li><code>cross-env NODE_OPTIONS=--max-old-space-size=8192 yarn print:heapsize &amp;&amp; tsc -p test/tsconfig.json --noEmit</code></li>
  <li><code>cross-env NODE_OPTIONS='--max-old-space-size=8192' yarn print:heapsize &amp;&amp; tsc -p test/tsconfig.json --noEmit</code> (just extra quotes around var)</li>
  <li><code>node --max-old-space-size=8192 ./node_modules/.bin/tsc -p test/tsconfig.json --noEmit</code></li>
  </ol>
  <p>Options #1 and #2 doesn't work, and #3 works fine, but it doesn't sound okay to me to run the binary and pass param  to the <code>node cli</code></p>
  <p><strong>So my question is - how do I set <code>max-old-spce-size</code> for <code>tsc</code> via <code>env variables</code> or maybe there is another good way to do it?</strong></p>
  <p><code>yarn print:heapsize</code> is the script I used to check current size - it shows 8gb for both #1 and #2 here it is:</p>
  <p><code>&quot;print:heapsize&quot;: &quot;node -e \&quot;console.log(' Current heap size:', (require('v8').getHeapStatistics().total_available_size  / 1024 / 1024 / 1024).toFixed(2), 'Gb')\&quot;&quot;</code></p>
  <p>and here's the output <a href="https://i.stack.imgur.com/AbL2V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AbL2V.png" alt="enter image description here" /></a></p>