Index: lib/compat.js |
=================================================================== |
--- a/lib/compat.js |
+++ b/lib/compat.js |
@@ -16,18 +16,25 @@ |
*/ |
// |
// Module framework stuff |
// |
function require(module) |
{ |
- return require.scopes[module]; |
+ let result = require.scopes[module]; |
+ if (typeof result == "function" && !(module in require.loaded)) |
+ { |
+ result = require.scopes[module] = result(); |
+ require.loaded[module] = true; |
+ } |
+ return result; |
} |
+require.loaded = Object.create(null); |
require.scopes = Object.create(null); |
function importAll(module, globalObj) |
{ |
var exports = require(module); |
for (var key in exports) |
globalObj[key] = exports[key]; |
} |