title: type error when running es6 code using gulp and babel
body: <p>I have the below es6 class which is in mqttModule.js.</p>
  
  <pre><code>/*jshint esversion: 6*/
  import mqtt from 'mqtt';
  
  let client;
  
  class MqttWrapper {
  
      constructor(mqttOptions) {
          this.clientId = mqttOptions.clientId;
          this.keepAlive = mqttOptions.keepAlive;
          this.clean = mqttOptions.clean;
          this.reconnectPeriod = mqttOptions.reconnectPeriod;
          this.will = mqttOptions.lastWillMessage;
  
          let options = {
              clientId: this.clientId,
              keepAlive: this.keepAlive,
              clean: this.clean,
              reconnectPeriod: this.reconnectPeriod,
              will: this.will
          };
  
          client = mqtt.connect(url, options);
      }
  }
  
  export {MqttWrapper};
  </code></pre>
  
  <p>and I am calling it as shown below.</p>
  
  <pre><code>import MqttWrapper from './mqttModule'
  
  let willMessage = {
    topic : 'WillMessage',
    payload : 'This is the last will message',
    qos : 2,
    retain : 'true'
  }
  
  let mqttOptions = {
    clientId : '101',
    keepAlive : 10,
    clean : 'false',
    reconnectPeriod : '1000',
    lastWillMessage : willMessage
  }
  
  let mqttWrapperObj = new MqttWrapper(mqttOptions);
  </code></pre>
  
  <p>When I run the gulp command it transpiles fine without any errors. But when I run it, I am getting the error saying type error. Below is the full trace.</p>
  
  <pre><code>G:\Projects\Kube2\edge-node-sdk-js-test\src\app.js:25
  var mqttWrapperObj = new _mqttModule2.default(mqttOptions);
                       ^
  
  TypeError: _mqttModule2.default is not a function
      at Object.&lt;anonymous&gt; (app.js:19:22)
      at Module._compile (module.js:409:26)
      at loader (G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\babel-cli\no
  de_modules\babel-register\lib\node.js:158:5)
      at Object.require.extensions.(anonymous function) [as .js] (G:\Projects\Kube
  2\edge-node-sdk-js-test\node_modules\babel-cli\node_modules\babel-register\lib\n
  ode.js:168:7)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Function.Module.runMain (module.js:441:10)
      at G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\babel-cli\lib\_babel
  -node.js:171:48
      at Object.&lt;anonymous&gt; (G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\
  babel-cli\lib\_babel-node.js:172:7)
      at Module._compile (module.js:409:26)
  
  npm ERR! Windows_NT 6.3.9600
  npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
  node_modules\\npm\\bin\\npm-cli.js" "start"
  npm ERR! node v4.4.4
  npm ERR! npm  v2.15.1
  npm ERR! code ELIFECYCLE
  npm ERR! edge-node-sdk-js-test@1.0.0 start: `babel-node --presets es2015 ./src/a
  pp.js`
  npm ERR! Exit status 1
  npm ERR!
  npm ERR! Failed at the edge-node-sdk-js-test@1.0.0 start script 'babel-node --pr
  esets es2015 ./src/app.js'.
  npm ERR! This is most likely a problem with the edge-node-sdk-js-test package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     babel-node --presets es2015 ./src/app.js
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs edge-node-sdk-js-test
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR!
  npm ERR!     npm owner ls edge-node-sdk-js-test
  npm ERR! There is likely additional logging output above.
  
  npm ERR! Please include the following file with any support request:
  npm ERR!     G:\Projects\Kube2\edge-node-sdk-js-test\npm-debug.log
  </code></pre>
  
  <p>Below is my gulp file just incase.</p>
  
  <pre><code>        /*jshint esversion: 6 */
  
  const gulp = require('gulp');
  const babel = require('gulp-babel');
  
  gulp.task('es6',() =&gt; {
    return gulp.src('src/app.js')
      .pipe(babel({
        presets: ['es2015']
      }))
      .pipe(gulp.dest('build'));
  });
  
  gulp.task('default',['es6'],() =&gt; {
    gulp.watch('src/app.js',['es6'])
  });
  </code></pre>
  
  <p>And below is the transpiled app.js file that gets created when I run the gulp command.</p>
  
  <pre><code>        'use strict';
  
  var _mqttModule = require('./mqttModule');
  
  var _mqttModule2 = _interopRequireDefault(_mqttModule);
  
  function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
  
  var willMessage = {
    topic: 'WillMessage',
    payload: 'This is the last will message',
    qos: 2,
    retain: 'true'
  }; /*jshint esversion: 6*/
  
  
  var mqttOptions = {
    clientId: '101',
    keepAlive: 10,
    clean: 'false',
    reconnectPeriod: '1000',
    lastWillMessage: willMessage
  };
  
  var mqttWrapperObj = new _mqttModule2.default(mqttOptions);
  </code></pre>
  
  <p>I am new to ES6 and babel stuff. Please advice. </p>