Add a javascript polyfill to gulp task -


i want add polyfill(s) here gulpfile. did bit of googling , found modules loading in collection of polyfills. in case need object.entries, feel overkill.

i assume have create file polyfill before adding gulp task.

here current gulpfile:

watchify.args.debug = true;  const sync = browsersync.create(); const reload = browsersync.reload;  // input file. var bundler = browserify('src/jsx/app.jsx', {     extensions: ['.js', '.jsx'],     debug: true });  // babel transform bundler.transform(babelify.configure({     sourcemaprelative: 'src',     presets: ["es2015", "react"] }));  // on updates recompile bundler.on('update', bundle);  function bundle() {     const packageinfo = json.parse(fs.readfilesync('./package.json'));     return bundler.bundle()         .on('error', function (err) {             console.log("=====");             console.error(err.tostring());             console.log("=====");             this.emit("end");         })         .pipe(exorcist('public/assets/js/'+packageinfo.name+'.js.map'))         .pipe(source(packageinfo.name+'.js'))         .pipe(buffer())         .pipe(rename(`${packageinfo.name}.js`))         .pipe(ifelse(process.env.node_env === 'production', uglify))         .pipe(gulp.dest('public/assets/js'))     ; }  gulp.task('default', ['transpile']);  gulp.task('transpile', ['lint'], () => bundle());  gulp.task('lint', () => {     return gulp.src([         'src/**/*.jsx',         'gulpfile.babel.js'     ])         .pipe(eslint())         .pipe(eslint.format())     ; });  gulp.task('serve', ['transpile','less','nodemon'], () => sync.init(null, {     proxy: "http://localhost:5050",     files: ["public/**/*.*"],     browser: "google chrome",     port: 7000 }));  gulp.task('nodemon', function (cb) {      var started = false;      return nodemon({         script: 'server.js'     }).on('start', function () {         // avoid nodemon being started multiple times         // @matthisk         if (!started) {             cb();             started = true;         }     }); });  gulp.task('js-watch', ['transpile'], () => sync.reload());  gulp.task('setproduction', () => {     const envs = env.set({         node_env: 'production'     });     return envs; });  gulp.task("less", function () {     const packageinfo = json.parse(fs.readfilesync("./package.json"));     return gulp.src("./src/less/__master.less")         .pipe(sourcemaps.init({includecontent: false}))         .pipe(less().on("error", console.error.bind(console)))         .pipe(rename(`${packageinfo.name}.min.css`))         .pipe(ifelse(process.env.node_env === "production", cleancss))         .pipe(sourcemaps.write())         .pipe(gulp.dest("./public/assets/css"))         /* reload browser css after every change */         .pipe(reload({stream:true}))     ; });  gulp.task('build', ['setproduction', 'less', 'transpile']);  gulp.task('watch', ['serve'], () => {     gulp.watch("src/**/*.less", ["less"]);     gulp.watch("src/**/*.js", ["transpile"]);     gulp.watch("src/**/*.jsx", ["transpile"]); });  gulp.task("default", ["watch"]); 

any help/advice appreciated, can't seem find info doesn't involve webpack.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -