difference between watchify and gulp.watch

3k views Asked by At

I have just started using Browserify with gulp and I came across examples using watchify.

What I don't understand is that why not use gulp.watch instead?
What is the difference between watchify and gulp.watch?

1

There are 1 answers

7
Prinzhorn On

watchify understands commonjs modules (require(./foo.js) stuff) and will watch for changes for all dependencies. It can then recompile the bundle with the changes needed and only reload the changed files from disk. If you use gulp.watch and manually call browserify, it has to build up the dependency tree every time a change happens. This means a lot more disk i/o and hence it will be much slower.