Last active
August 29, 2015 13:57
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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