diff --git a/lib/build-bundle.js b/lib/build-bundle.js index 4f6645d..bdb1f3d 100644 --- a/lib/build-bundle.js +++ b/lib/build-bundle.js @@ -10,6 +10,7 @@ function compile(path, options) { insertGlobals: options.insertGlobals, detectGlobals: options.detectGlobals, ignoreMissing: options.ignoreMissing, + bundleExternal: options.bundleExternal, basedir: options.basedir, debug: options.debug, standalone: options.standalone || false, diff --git a/test/directory/no-bundle-external.js b/test/directory/no-bundle-external.js new file mode 100644 index 0000000..bccbc44 --- /dev/null +++ b/test/directory/no-bundle-external.js @@ -0,0 +1,7 @@ +module.exports.server= function(){ + var path= require('path') + console.log('Expose for server') +} +module.exports.client= function(){ + console.log('Expose for client') +} \ No newline at end of file diff --git a/test/index.js b/test/index.js index eda9bd9..190f3e8 100644 --- a/test/index.js +++ b/test/index.js @@ -158,6 +158,11 @@ app.get('/opt/no-minify.js', browserify(__dirname + '/directory/no-minify.js', { debug: false })); +app.get('/opt/no-bundle-external.js', browserify(__dirname + '/directory/no-bundle-external.js', { + bundleExternal: false, + debug: false, +})); + var port; (function () { var listeners = []; @@ -437,3 +442,16 @@ describe('options.noParse', function () { }); }); }); + +describe('options.bundleExternal= false', function () { + it('Exclude node_modules and builtins', function (done) { + this.slow(1000) + this.timeout(20000) + var start = new Date(); + get('/opt/no-bundle-external.js', false, function (err, res) { + if (err) return done(err); + assert.equal(res.match(/Copyright Joyent, Inc/), null); + done(); + }); + }); +}); \ No newline at end of file