jmreidy/grunt-browserify — pull request #45 by robbles (2013-05-16 21:32:53+00:00)
Title: Compatibility fix for older node versions

I was having issues running this task on node v0.8.18. I saw that it's only supposed to run on node >=0.10.x, but npm doesn't enforce this unless you set [`engineStrict`](https://npmjs.org/doc/json.html#engineStrict) to true in your package.json.

Anyways, the only issue I saw was the task would only run one target and then stop. I tracked it down to the events when writing each bundle to a file - the `finish` event doesn't fire in v0.8.18 on the write stream. Not sure if this is a change in node, or a bug in browserify, but this commit fixes that by listening for the `end` event on the bundle stream instead.

If you don't want this changed, I'd suggest turning on `engineStrict` instead, because it definitely doesn't work in v0.8.18.