Different behavior between ES6 and ES2016 using babel on cluster.on
<p>I am trying to use cluster to exploit the benefit of having multi-core CPUs. With code:</p>

<pre><code>var cluster = require('cluster');

if (cluster.isMaster) {
    for(var i = 0; i &lt; 2; ++i) {
        cluster.fork();
    }
    cluster.on('exit', function (worker) {
        console.log('Worker ' + worker.process.pid + ' exitted.');
    });
} else {
    console.log('Worker ' + cluster.worker.process.pid);
    process.exit(0);
}
</code></pre>

<p>node worked perfectly with output</p>

<pre><code>Worker 14058
Worker 14064
Worker 14058 exitted.
Worker 14064 exitted.
</code></pre>

<p>However, when I tried to use <code>import</code> together with babel, I got problems:</p>

<pre><code>import *  as cluster from 'cluster'

if (cluster.isMaster) {
    for(let i = 0; i &lt; 2; ++i) {
        cluster.fork();
    }
    cluster.on('exit', (worker) =&gt; console.log('Worker ' + worker.process.pid + ' exitted.'));
} else {
    console.log('Worker ' + cluster.worker.process.pid);
    process.exit(0);
}
</code></pre>

<p>the output (after babel) of node is:</p>

<pre><code>2.js:13
    cluster.on('exit', function (worker) {
            ^

TypeError: cluster.on is not a function
    at Object.&lt;anonymous&gt; (2.js:13:13)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
Worker 14140
Worker 14146
</code></pre>

<p>This looks weird. I am using node <code>v6.4.0</code>, with babel <code>6.11.4 (babel-core 6.13.2)</code>, the content of <code>.babelrc</code> is:</p>

<pre><code>{
  "presets": ["es2016", "es2015"]
}
</code></pre>

<p>Any ideas what happened?</p>