Skip to content

Instantly share code, notes, and snippets.

@antialias
Last active August 29, 2015 13:57
Show Gist options
  • Save antialias/9688098 to your computer and use it in GitHub Desktop.
Save antialias/9688098 to your computer and use it in GitHub Desktop.
Using browserify's deps function to create a mapping between bundles and their dependencies.
var b = require('browserify')();
var dep2bundleSrcs = [];
b.add(modulePath);
b.deps().pipe(require('through')(function (dep) {
var fullPath = path.resolve(dep.id);
if (undefined === dep2bundleSrcs[fullPath]) {
dep2bundleSrcs[fullPath] = [];
console.log("adding bundle for dep", fullPath);
}
dep2bundleSrcs[fullPath].push(bundleMainScriptPath);
bundlesBySrc[bundleMainScriptPath] = fileData;
})).pipe(process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment