How to use babel-polyfill with Gulp

I’m new to gulp, trying to change the build so I can take advantage of all new features for ES 6. I ran nmp install to get babel-polyfill. In my babel.rc file I have:

{
  "presets": ["react", "es2015"],
  "plugins": [
"transform-decorators-legacy",
["babel-root-import", {"rootPathSuffix":"src/js"}],
"babel-polyfill"
  ]
}

and then in my gulp file I have:

var babelifyJs = function(browserifyResult) {
  var bundleJs = browserifyResult

    .transform(babelify.configure())
    .transform(envify({NODE_ENV: {environment: environment}}))
    .bundle()
    .on('error', function(error) {
      console.log(error.message);
      notify().write(error);
      bundleJs.end();
      return;
    })
    .pipe(source('bundle.min.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({ loadMaps: true }))
    .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('build/'));
  return bundleJs;
};

Any ideas, where and how do I modify this so I can use babel-polyfill?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.