Skip to content

Doesn't work if .pipe() not called #38

@bclinkinbeard

Description

@bclinkinbeard

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions