Index: templates/modules.js.tmpl |
diff --git a/templates/modules.js.tmpl b/templates/modules.js.tmpl |
index c826d892704589d344ecb9fadb61348ab8448b3b..c1956d9b51607f53cc876736d003c55b6861a3d4 100644 |
--- a/templates/modules.js.tmpl |
+++ b/templates/modules.js.tmpl |
@@ -1,4 +1,16 @@ |
{%- if args["module"] -%} |
+function require(module) |
+{ |
+ if (!(module in require.scopes)) |
+ { |
+ let scope = {exports: {}}; |
+ require.scopes[module] = require.modules[module](scope, scope.exports); |
+ } |
+ return require.scopes[module]; |
+} |
+require.modules = Object.create(null); |
+require.scopes = Object.create(null); |
+ |
{%- for module_name, script in modules -%} |
require.modules[{{ module_name|json }}] = function(module, exports) |
{ |