browserify-incremental icon indicating copy to clipboard operation
browserify-incremental copied to clipboard

Doesn't work if .pipe() not called

Open bclinkinbeard opened this issue 7 years ago • 0 comments

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.

bclinkinbeard avatar May 18 '17 20:05 bclinkinbeard