<p dir="auto">This <a href="https://gist.github.com/Gerhut/0a5b94f81b84617ac23c">gist</a> records my input file &amp; output files when using <code class="notranslate">common</code> and <code class="notranslate">system</code> module option.</p>
<p dir="auto">In <a href="https://gist.github.com/Gerhut/0a5b94f81b84617ac23c#file-output-common-js-L31">Line 31 of output-common.js</a>, it compiles 'for (let b of a())' to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for (var _iterator = a()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">_iterator</span> <span class="pl-c1">=</span> <span class="pl-en">a</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">[</span><span class="pl-v">Symbol</span><span class="pl-kos">.</span><span class="pl-c1">iterator</span><span class="pl-kos">]</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">_step</span><span class="pl-kos">;</span> <span class="pl-c1">!</span><span class="pl-kos">(</span><span class="pl-s1">_iteratorNormalCompletion</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">_step</span> <span class="pl-c1">=</span> <span class="pl-s1">_iterator</span><span class="pl-kos">.</span><span class="pl-en">next</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">done</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-s1">_iteratorNormalCompletion</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos"></span></pre></div>
<p dir="auto">But in <a href="https://gist.github.com/Gerhut/0a5b94f81b84617ac23c#file-output-system-js-L37">Line 37 of output-system.js</a>, it compiles to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for (_iterator; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-s1">_iterator</span><span class="pl-kos">;</span> <span class="pl-c1">!</span><span class="pl-kos">(</span><span class="pl-s1">_iteratorNormalCompletion</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">_step</span> <span class="pl-c1">=</span> <span class="pl-s1">_iterator</span><span class="pl-kos">.</span><span class="pl-en">next</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">done</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-s1">_iteratorNormalCompletion</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos"></span></pre></div>
<p dir="auto">without initialize of <code class="notranslate">_iterator</code>, lead to a <code class="notranslate">Cannot read property 'next' of undefined()</code> error.</p>
<p dir="auto">My Babel compiler version is 5.6.14</p>
<p dir="auto">Thank you for your work.</p>
<p dir="auto">Not sure if this is your bug. When calling babel for following example (loop.js) I got an unusable output.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for (let i = 0; i &lt; 10; i++) {
  console.log(i);
}"><pre class="notranslate"><span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">let</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">10</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">i</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Using babel 5.6.14 (Windows) with modules system</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="babel loop.js --modules system"><pre class="notranslate"><code class="notranslate">babel loop.js --modules system
</code></pre></div>
<p dir="auto">Output: Variable i is never initialized, console.log is never called</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="System.register([], function (_export) {
  &quot;use strict&quot;;

  var i;
  return {
    setters: [],
    execute: function () {
      for (i; i &lt; 10; i++) {
        console.log(i);
      }
    }
  };
});"><pre class="notranslate"><span class="pl-v">System</span><span class="pl-kos">.</span><span class="pl-en">register</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">_export</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s">"use strict"</span><span class="pl-kos">;</span>

  <span class="pl-k">var</span> <span class="pl-s1">i</span><span class="pl-kos">;</span>
  <span class="pl-k">return</span> <span class="pl-kos">{</span>
    <span class="pl-c1">setters</span>: <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-en">execute</span>: <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-s1">i</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">10</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">i</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
      <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>