title: Why shouldn't babel-node be used in production?
body: <p>The <a href="https://babeljs.io/docs/usage/cli/" rel="nofollow noreferrer">babel-node docs</a> carry a stern warning:</p>
  
  <blockquote>
    <h3>Not meant for production use</h3>
    
    <p>You should not be using <code>babel-node</code> in production. It is unnecessarily heavy, with high memory usage due to the cache being stored in memory. You will also always experience a startup performance penalty as the entire app needs to be compiled on the fly.</p>
  </blockquote>
  
  <p>Let's break this down:</p>
  
  <ul>
  <li><p>Memory usage – huh? All modules are 'cached' in memory for the lifetime of your application anyway. What are they getting at here?</p></li>
  <li><p>Startup penalty – how is this a performance problem? Deploying a web app already takes several seconds (or minutes if you're testing in CI). Adding half a second to startup means nothing. In fact if startup time matters anywhere, it matters more in development than production. If you're restarting your web server frequently enough that the startup time is an issue, you've got much bigger problems.</p></li>
  </ul>
  
  <p>Also, there is no such warning about using Babel's <a href="https://babeljs.io/docs/usage/require/" rel="nofollow noreferrer">require hook</a> (<code>require('babel-register')</code>) in production, even though this presumably does pretty much exactly the same thing as babel-node. For example, you can do <code>node -r babel-register server.js</code> and get the same behaviour as <code>babel-node server.js</code>. (My company does exactly this in hundreds of microservices, with no problems.)</p>
  
  <p>Is Babel's warning just FUD, or am I missing something? And if the warning is valid, why doesn't it also apply to the Babel require hook?</p>
  
  <hr>
  
  <p><strong>Related</strong>: <a href="https://stackoverflow.com/questions/30773756/is-it-okay-to-use-babel-node-in-production">Is it okay to use babel-node in production</a> 
  – but that question just asks <em>if</em> production use is recommended, and the answers just quote the official advice, i.e. "No". In contrast, I am questioning the reasoning behind the official advice.</p>