diff --git a/index.js b/index.js index ec1e47a..24a1b47 100644 --- a/index.js +++ b/index.js @@ -67,7 +67,7 @@ module.exports = function (opts) { if (first) this.queue(prelude + '({'); entries = entries.filter(function (x) { return x !== undefined }); - this.queue('},{},' + JSON.stringify(entries) + ')'); + this.queue('},' + JSON.stringify(entries) + ')'); if (sourcemap) this.queue('\n' + sourcemap.comment()); this.queue(null); diff --git a/prelude.js b/prelude.js index ae8e72f..8861b2f 100644 --- a/prelude.js +++ b/prelude.js @@ -7,9 +7,10 @@ // anything defined in a previous bundle is accessed via the // orig method which is the requireuire for previous bundles -(function(modules, cache, entry) { +(function(modules, entry) { // Save the require from previous bundle to this closure if any var previousRequire = typeof require == "function" && require; + var cache = {}; function newRequire(name, jumped){ if(!cache[name]) { @@ -35,6 +36,13 @@ } return cache[name].exports; } + + // A means of resetting the module cache when necessary; for example, + // between test runs. + newRequire.dumpCache = function() { + cache = {}; + }; + for(var i=0;i