Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: templates/modules.js.tmpl

Issue 29549786: Issue 5535 - Replace our module system with webpack (Closed)
Left Patch Set: Addressed Wladimir's feedback Created Oct. 4, 2017, 1:08 p.m.
Right Patch Set: Addressed final nits Created Oct. 10, 2017, 5:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « packagerEdge.py ('k') | webpack_runner.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 {%- if args["module"] -%}
2 if (typeof require != "function")
3 {
4 var require = function(module)
5 {
6 if (!(module in require.scopes))
7 {
8 let scope = {exports: {}};
9 require.scopes[module] = require.modules[module](scope, scope.exports);
10 }
11 return require.scopes[module];
12 };
13 require.modules = Object.create(null);
14 require.scopes = Object.create(null);
15 }
16
17 {% if args["injectinfomodule"] %}
18 require.modules["info"] = function(module, exports)
19 {
20 {% if type == "gecko-webext" %}
21 {% include "geckoInfo.js.tmpl" %}
22 {% elif type == "chrome" %}
23 {% include "chromeInfo.js.tmpl" %}
24 {% elif type == "edge" %}
25 {% include "edgeInfo.js.tmpl" %}
26 {% endif %}
27 return module.exports;
28 };
29 {% endif %}
30
31 {%- for module_name, script in modules -%}
32 require.modules[{{ module_name|json }}] = function(module, exports)
33 {
34 {{ script }}
35 return module.exports;
36 };
37
38 {% endfor -%}
39 {%- set modules = dict(modules) -%}
40 {%- for module_name in args["autoload"] -%}
41 {%- if module_name in modules -%}
42 require({{ module_name|json }});
43 {% endif %}
44 {%- endfor -%}
45 {%- else -%}
46 {%- for module_name, script in modules -%}
47 {{ script }}
48 {% endfor -%}
49 {%- endif -%}
LEFTRIGHT

Powered by Google App Engine
This is Rietveld