Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion prelude.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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<entry.length;i++) newRequire(entry[i]);

// Override the current require with this new one
Expand Down