From 5d56a05531f1e5030c9d0e5cf5e7f9f1c936767a Mon Sep 17 00:00:00 2001 From: TheKiba Date: Sat, 6 Aug 2016 02:20:44 +0200 Subject: [PATCH 1/2] This commit fixes #243 - hotfix call browserify.require(file, opts) --- lib/bundle.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bundle.js b/lib/bundle.js index 53fd0d8..bc2460b 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -89,9 +89,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); } } From 03374f9f47181f8ad72935910e7e51fb89f0557e Mon Sep 17 00:00:00 2001 From: TheKiba Date: Thu, 11 Aug 2016 21:08:12 +0200 Subject: [PATCH 2/2] Added global variable isNexe --- lib/bundle.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bundle.js b/lib/bundle.js index bc2460b..b8a5670 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -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.