browserify / watchify

watch mode for browserify builds
Other
1.79k stars 203 forks source link

Silent error while bundling with Watchify #323

Closed Henauxg closed 6 years ago

Henauxg commented 8 years ago

I use Browserify with watchify within gulp.

The (simplified) utilisation looks like this:

gulp.task("taskName", function() {
    var b = browserify({
        entries: ['./entryFile'],
        cache: {},
        packageCache: {},
    });
    b.plugin(watchify);

    b.on('update', bundle);
    bundle();

    function bundle() {
        b.bundle()
        .pipe(fs.createWriteStream('output.js'));
    }
})

The problem is that for any syntax error in the entries, the process (gulp taskName) will hang and not giving any info on the error.

I found a way to have the info by adding .on('error', function (e) {throw e;}) right after the .bundle(), but if I insert it anywhere else in the pipe chain of b.bundle. ... nothing happens. I can also remove the watchify plugin and then the error is displayed.

Is it really what should happen? And also if it is, shouldn't it be documented somewhere? Because when no feedback is returned, it's quite a bore to know what actually causes the process to block and who (watchify here I suppose) could potentially keep the error.

versions: browserify@13.0.1 watchify@3.7.0

zookatron commented 7 years ago

I just spend 3 hours messing around with different error handlers before I found this.

This really needs to be fixed and/or better documented!