Search code examples
gulpbrowserifyreactify

use gulp+browserify+reactify, can't emit exit when got a ReactifyError


Belowing is a gulp task code, I want gulp stay running when got an error.

gulp.task('tmp-script', function() {
glob('./app/pages/*.js', {}, function(err, files) {
    files.forEach(function(file) {
        browserify(file, {
            transform: [reactify]
        })
        .bundle()
        .on('error', function(err){
          console.log(err.message);
          this.emit('end');
        })
        .pipe(source(file.replace('./app/pages/', '')))
        .pipe(gulp.dest('.tmp/js'));
    });
});

});

But it only works for the first time. When got an error again, it quit with this: enter image description here

What can I do?


Solution

  • My fault, it is a bad question, I didn't add .on(error) function to gulp(watch) task ...