title: Bundling Vendor Files Using Gulp
body: <p>I am trying to split my source code from vendor using <code>gulp</code>. At the current state, this is how my <code>gulpfile.js</code> is setup:</p>
  
  <p><code>gulpfile.js</code></p>
  
  <pre><code>/////////////       LIBS        \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  
  var gulp = require('gulp');
  var browserSync = require('browser-sync').create();
  var superstatic = require('superstatic');
  var gulpTsc = require('gulp-typescript');
  var sourcemaps = require('gulp-sourcemaps');
  var tsConfigGlob = require('tsconfig-glob');
  var browserify = require('browserify');
  var path = require('path');
  var child_process = require('child_process');
  var del = require('del');
  var sourceStream = require('vinyl-source-stream');
  
  // other tasks
  
  var bundleVendorFiles = function(done) {
  var deps = Object.keys(ngPkgFile &amp;&amp; ngPkgFile.dependencies || {});
  deps.map(d =&gt; {
      let posOfAt = d.indexOf('@'),
          modName = `${angularAppLocation}/node_modules/`,
          exposeName = d;
      if(posOfAt &lt; 0) modName += d;
      else modName += `@angular/${d.split('/').pop()}`;
      return {
          file: modName,
          expose: exposeName
      };    
  });
  browserify({
      paths: [angularAppLocation+'/node_modules'],
      basedir: '/home/zerocool/srs-demo/loginapp'
  })
      .require(deps)
      .transform("babelify", { presets: ["es2015"]})
      .bundle()
      .pipe(sourceStream('vendor.bundle.js'))
      .pipe(gulp.dest(angularAppLocation+'/dist'));
  done();
  };
  
  gulp.task('default', gulp.series([
  'clean-dist-dir', 'copy-index-file', 'expand-file-glob',
  'ts-compile', 'bundle-vendor-pkgs',/*
  'copy-static-assets', 'copy-misc-asset-files'*/
  ]));
  </code></pre>
  
  <p>I have tested all the other tasks and they all are working properly. When I run <code>gulp</code> with this file I get the following output at the <code>console</code></p>
  
  <pre><code>[02:31:16] Using gulpfile ~/srs-demo/gulpfile.js
  [02:31:16] Starting 'default'...
  [02:31:16] Starting 'clean-dist-dir'...
  [02:31:16] Finished 'clean-dist-dir' after 9.41 ms
  [02:31:16] Starting 'copy-index-file'...
  [02:31:16] Finished 'copy-index-file' after 13 ms
  [02:31:16] Starting 'expand-file-glob'...
  [02:31:16] Finished 'expand-file-glob' after 38 ms
  [02:31:16] Starting 'ts-compile'...
  [02:31:16] Finished 'ts-compile' after 407 ms
  [02:31:16] Starting 'bundle-vendor-pkgs'...
  [02:31:16] Finished 'bundle-vendor-pkgs' after 29 ms
  [02:31:16] Finished 'default' after 501 ms
  
  events.js:112
    throw er; // Unhandled 'error' event
    ^
  SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
  </code></pre>
  
  <p>What am I missing in this <code>gulpfile</code>? Do I need any other setup besides the <code>gulpfile</code>? I am new with <code>gulp</code> so, if more information is needed, please ask. Thanks</p>