Index: templates/modules.js.tmpl |
diff --git a/templates/modules.js.tmpl b/templates/modules.js.tmpl |
index c826d892704589d344ecb9fadb61348ab8448b3b..89d74e4ea5969b6a869eb7dabb86bcda165f8ab7 100644 |
--- a/templates/modules.js.tmpl |
+++ b/templates/modules.js.tmpl |
@@ -1,4 +1,29 @@ |
{%- if args["module"] -%} |
+if (typeof require == "undefined") |
+{ |
+ window.require = function(module) |
Sebastian Noack
2017/03/31 14:50:45
This will still assume that there is a global "win
kzar
2017/03/31 15:16:54
Perhaps it matters for Firefox, can't harm to fix
kzar
2017/03/31 15:27:37
(gecko-webext devbuild seems to run OK with these
|
+ { |
+ 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); |
+} |
+ |
+require.modules["info"] = function(module, exports) |
Sebastian Noack
2017/03/31 14:50:45
The "info" module should only be added for the bac
kzar
2017/03/31 15:16:54
Done.
|
+{ |
+{% if type == "gecko-webext" %} |
+{% include "geckoInfo.js.tmpl" %} |
Sebastian Noack
2017/03/31 14:50:45
Why not just inline them here? Those templates are
kzar
2017/03/31 15:16:54
I prefer them as separate files, I think it's easi
|
+{% elif type == "chrome" or type == "edge" %} |
+{% include "chromeInfo.js.tmpl" %} |
+{% endif %} |
+return module.exports; |
+}; |
+ |
{%- for module_name, script in modules -%} |
require.modules[{{ module_name|json }}] = function(module, exports) |
{ |