I use Gulp as my task runner and browser to bundle my CommonJs modules.
I noticed that launching my task on the browser is rather slow, it takes about 2 - 3 seconds, and all I have is React and some very small components that I created for development.
Is there a way to speed up the task or do I have any noticeable problems in my task?
gulp.task('browserify', function() { var bundler = browserify({ entries: ['./main.js'], // Only need initial file transform: [reactify], // Convert JSX to javascript debug: true, cache: {}, packageCache: {}, fullPaths: true }); var watcher = watchify(bundler); return watcher .on('update', function () { // On update When any files updates var updateStart = Date.now(); watcher.bundle() .pipe(source('bundle.js')) .pipe(gulp.dest('./')); console.log('Updated ', (Date.now() - updateStart) + 'ms'); }) .bundle() // Create initial bundle when starting the task .pipe(source('bundle.js')) .pipe(gulp.dest('./')); });
I use Browserify, Watchify, Reactify and Vinyl Source Stream, as well as several other unrelated modules.
var browserify = require('browserify'), watchify = require('watchify'), reactify = require('reactify'), source = require('vinyl-source-stream');
thanks
javascript reactjs gulp browserify watchify
steven iseki
source share