Skip to content

Commit

Permalink
[Fix] require.js: Now using a global context
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoric committed Mar 13, 2012
1 parent d64a3ad commit 1606007
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/comp/require.js
Expand Up @@ -26,13 +26,16 @@
}
let evaluated =
(function() {
evalWithLocation(
let global = newGlobal('same-compartment');
global.require = require;
global.exports = {};
global.module = {};
evalWithLocation.call(global,
'"use strict";\n\n'+
'let exports = {};\n'+
'let module = {};\n' + // Unused atm
source, fileName, 1);
return {exports: exports,
module: module};
source
, fileName, 1);
return {exports: global.exports,
module: global.module};
})();
modules[":"+fileName] = evaluated.exports;
modules[":"+moduleName] = evaluated.exports;
Expand Down

0 comments on commit 1606007

Please sign in to comment.