browserify / watchify

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

Building same file multiple times #329

Closed bushd closed 8 years ago

bushd commented 8 years ago

Hi,

quick setup info: I have multiple javascript files that are watched, let's call them a.js, b.js and c.js. These files are never loaded at the same time by the browser. I have some modules that are part of multiple javascript files. Let's call them m1 and m2 When I modify these modules it builds the matching files - all good. a.js contains m1 and m2, b.js m1 and c.js m3

I change m1 and it builds a.js and b.js I change m2 and it builds b.js and c.js

If i change a m1 while it is still building b.js (for example) it builds a.js, b.js and b.js

this gets worse the more files i touch and the more my modules are reused. Since the build takes quite some time, it is simply not feasible to wait for building to complete before I touch another file.

Is there a way to prevent such a behaviour? Can't watchify see that a file is already building and either wait or stop the initial build? And why is it building the same files multiple times?

(edit: I run watchify/browserify via gulp, in case that matters)

bushd commented 8 years ago

I think I found the issue with the initialisation code.