Here is my gulpfile.js
var gulp = require('gulp');
var browserify = require('browserify');
var source = require("vinyl-source-stream");
var reactify = require("reactify");
var watchify = require('watchify');
var gutil = require('gulp-util');
var paths = {
scripts: ['src/jsx/index.jsx']
};
gulp.task('browserify', function(){
var bundler = watchify(browserify('./src/jsx/index.jsx', watchify.args));
bundler.transform(reactify);
bundler.on('update', rebundle);
function rebundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
.pipe(gulp.dest('./public/js'));
}
return rebundle();
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['browserify']);
});
Then my commandline output looks like this:
$ gulp watch
[15:10:41] Using gulpfile ~/blizztrack/dashboard/gulpfile.js
[15:10:41] Starting 'watch'...
[15:10:41] Finished 'watch' after 9.95 ms
save index.jsx
[15:10:45] Starting 'browserify'...
[15:10:51] Finished 'browserify' after 5.33 s
save index.jsx the second time
[15:11:08] Starting 'browserify'...
[15:11:10] Finished 'browserify' after 2.02 s
save index.jsx the third time
No output.
This seems to be doing exactly what I want it to the first two times, and then it just stops watching. Can anyone point me in the right direction?