An earlier attempt at this was 8168edfe2283c2e90ac4389333074f58a030f8cb, which added a flag --write-on-done that waited until the entire bundle was done before beginning to write.
The current approach is better because it has the best of both worlds. It starts to write when data is actually available, but doesn't buffer everything. module-deps is the slowest part of the pipeline, however, it's actually deps-sort that causes the bottleneck – since it has to wait until all the rows are done before it can sort them.
This waits until browser-pack has something to be read before opening the write stream. This prevents issues with bundles that have a long processing time (mostly in module-deps), where you'd have 0 byte output file for a while before anything actually gets written to it.
An earlier attempt at this was 8168edfe2283c2e90ac4389333074f58a030f8cb, which added a flag
--write-on-done
that waited until the entire bundle was done before beginning to write.The current approach is better because it has the best of both worlds. It starts to write when data is actually available, but doesn't buffer everything. module-deps is the slowest part of the pipeline, however, it's actually deps-sort that causes the bottleneck – since it has to wait until all the rows are done before it can sort them.
This waits until browser-pack has something to be read before opening the write stream. This prevents issues with bundles that have a long processing time (mostly in module-deps), where you'd have 0 byte output file for a while before anything actually gets written to it.
Fixes #239 and #272