diff --git a/gulp/util/bundle.js b/gulp/util/bundle.js index b076faa..a65e5c4 100644 --- a/gulp/util/bundle.js +++ b/gulp/util/bundle.js @@ -33,11 +33,13 @@ function watch(onUpdate) { var bundler = watchify(createBundler(watchify.args)); - if (onUpdate) { - bundler.on('update', function () { - rebundle.call(this).on('end', onUpdate); - }); - } + bundler.on('update', function () { + var bundle = rebundle.call(this); + + if (onUpdate) { + bundle.on('end', onUpdate); + } + }); return rebundle.call(bundler); }