Merge pull request #244 from thekiba/issue-243

#243 - hotfix call browserify.require(file, opts)
This commit is contained in:
Jared Allard
2016-08-23 14:33:15 -07:00
committed by GitHub
+8 -3
View File
@@ -46,9 +46,8 @@ function bundle(input, nc, options, complete) {
const mapfile = options.output+'.map';
let ws = fs.createWriteStream(bundlePath);
const igv = '__filename,__dirname,_process';
let insertGlobalVars = {},
let insertGlobalVars = { isNexe: true },
wantedGlobalVars = igv.split(',');
// parse insertGlobalVars.
@@ -89,9 +88,15 @@ function bundle(input, nc, options, complete) {
for (let i = 0; i < options.browserifyRequires.length; i++) {
let lib = options.browserifyRequires[i];
let name = lib.file || lib; // for object format.
// if `lib` is object then fetch all params without `file`
// otherwise returns empty object
let opts = (lib instanceof Object) && Object.keys(lib)
.filter((key) => key !== 'file')
.reduce((acc, key) => { return acc[key] = lib[key], acc }, {})
|| {};
_log('Force including \'%s\' in browserify bundle', name);
bproc.require(lib);
bproc.require(lib, opts);
}
}