title: Converting a JavaScript file with Babel for use in IE11
body: <p>I have a JavaScript file <code>mystuff.js</code> which throws errors in IE11 (due to for..of loops, etc).</p>
  <p>So I try to convert it with Babel for use in IE11. However the output from Babel does not seem to be IE11-compatible. (IE complains &quot;<em>SCRIPT5009: 'require' is undefined</em>&quot;.)</p>
  <p>It looks like the result of Babel is not really JavaScript for IE11...</p>
  <hr />
  <p>For reference here the steps I did:</p>
  <ol>
  <li><p>I install</p>
  <pre><code> yarn add -D @babel/core @babel/cli @babel/preset-env
   yarn add @babel/polyfill
  </code></pre>
  </li>
  <li><p>I create a <code>babel.config.json</code> with the following content:</p>
  </li>
  </ol>
  <pre><code>{
    &quot;presets&quot;: [
      [
        &quot;@babel/env&quot;,
        {
          &quot;targets&quot;: {
            &quot;edge&quot;: &quot;17&quot;,
            &quot;firefox&quot;: &quot;60&quot;,
            &quot;chrome&quot;: &quot;67&quot;,
            &quot;safari&quot;: &quot;11.1&quot;,
              &quot;ie&quot;: &quot;11&quot;
          },
          &quot;useBuiltIns&quot;: &quot;usage&quot;,
          &quot;corejs&quot;: &quot;3.6.4&quot;,
        }
      ]
    ]
  }
  </code></pre>
  <ol start="2">
  <li><p>I have my JavaScript file in <code>src</code> so I run</p>
  <pre><code> yarn babel src --out-dir lib
  </code></pre>
  </li>
  <li><p>I create a new HTML file from my old HTML file so that it loads the JavaScript from  <code>lib</code> instead of <code>src</code>:</p>
  <pre><code> &lt;div id = &quot;info&quot;&gt;...&lt;/div&gt;
   &lt;script src=&quot;./lib/mystuff.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  </li>
  <li><p>I serve and view the HTMLfile in IE11, but get the aforementioned error in IE's console.</p>
  </li>
  </ol>