简体   繁体   中英

Whats the difference between Gulp-Browserify and Browserify?

I've recently made the transition over from Grunt to Gulp. I'm still fairly new however, could anyone tell me what the difference is between using Gulp-Browserify and just using Browserify?

I know Gulp-Browserify has now been blacklisted and I seen a few discussions about it. I was wondering what the Gulp version did that Browserify doesn't?

The difference is that browserify doesn't natively read and emit the vinyl files that the gulp pipeline deals with. gulp-browserify was an adapter for that, and I believe it did some extra things related to error handling. If possible I recommend that for the time being you avoid using gulp-browserify. In gulp 4 there may be a better way to integrate browserify with gulp. For now, see if this works for you:

var vss = require('vinyl-source-stream');

gulp.task('whatever', function () {
  var b = browserify(entry, b_opts)
    .transform(some_xform);

  return b.bundle()
    .pipe(vss('bundle.js'))
    // ... gulp stuff
    .pipe(gulp.dest(dest));
});

This will generally require you to do per-file manipulations with browserify transforms and then only do bundle-level manipulation in the gulp pipeline.

Further reading: gulpjs/gulp#369

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM