browserify-incremental
browserify-incremental copied to clipboard
Doesn't work if .pipe() not called
Vanilla browserify allows you to do b.bundle(cb)
and get the bundle passed into cb
, but with browserify-incremental
the callback will only be called if .pipe(someStream)
is included.
This code works:
var fs = require('fs');
var browserifyInc = require('browserify-incremental');
var b = browserifyInc({
entries: ['entry.js'],
cache: {},
packageCache: {},
fullPaths: true,
cacheFile: 'cache.json'
});
b.on('log', console.log.bind(console));
bundle();
function bundle() {
b.bundle().pipe(fs.createWriteStream('output.js'));
}
but if bundle
is changed to b.bundle()
, the cache file is never written and therefore incremental builds do not work.
Is this a bug or am I missing some valid reason this has to happen? If it's expected behavior it should probably be documented.