jsdf / browserify-incremental

incremental rebuild for browserify
175 stars 13 forks source link

When used with require-globify cache is not invalidated properly #34

Open futpib opened 8 years ago

futpib commented 8 years ago

capaj/require-globify lets you write code like

// index.js
const templates = require('./templates/*', { mode: 'hash' });

which at some point expands into

var templates = {
    'a': require('./template/a.html'),
    'b': require('./template/b.html')
};

When used with browserify-incremental index.js is not rebuilt after contents of the template directory change (like adding or removing a file).

My build script looks like this

// gulpfile.js
var b = browserify(_.defaults({
    entries: entries,
    debug: true
}, browserifyInc.args));

b.transform('require-globify');

browserifyInc(b, {
    cacheFile: './.browserify-incremental-cache.json'
});

Maybe there is a way to make browserify-incremental kick in after require-globify transform?