jsdf / browserify-incremental

incremental rebuild for browserify
175 stars 13 forks source link

not using cache between builds #18

Closed orlando closed 9 years ago

orlando commented 9 years ago

Probably this is specific to my configuration, but is nothing different from a standard build task with gulp.

var b = browserify(bundleConfig);
browserifyInc(b, {cacheFile: './tmp/cache/browserify/browserifyinc-cache.json'});

at the end of the build, there's a cache file created, but between each build, when starts browserify, it doesn't use the file and recreates every time.

Is there anything extra that I need to do to get cacheFile working?

Thanks!

andrewhamon commented 9 years ago

Did you make sure to include the required option keys in bundleConfig.

From the readme:

You can also pass in a browserify instance of your own, and that will be used instead of creating a new one, however when you create your browserify instance you must include the following options:

{cache: {}, packageCache: {}, fullPaths: true}

For convenience, these options are available as browserifyInc.args, so you can use them like:

var browserify = require('browserify')
var browserifyInc = require('browserify-incremental')
var xtend = require('xtend')
var b = browserify(xtend(browserifyInc.args, {
  // your custom opts
}))
browserifyInc(b, {cacheFile: './browserify-cache.json'})
b.bundle().pipe(process.stdout)
orlando commented 9 years ago

Given your example, I'm doing the same thing. But this is not an issue anymore for me, I'll close this issue.

Thanks for your help @andrewhamon