Skip to content

Commit a83e15f

Browse files
committed
save 8 chars
1 parent e58f315 commit a83e15f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/MainTemplate.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ MainTemplate.prototype = Object.create(Template.prototype);
1616
MainTemplate.prototype.requireFn = "require";
1717
MainTemplate.prototype.render = function(hash, chunk, moduleTemplate, dependencyTemplates) {
1818
var buf = [];
19+
buf.push("// shortcut for better minimizing");
20+
buf.push("var exports = \"exports\";");
1921
buf.push(this.asString(this.renderAdditions(hash, chunk, moduleTemplate, dependencyTemplates)));
2022
buf.push(this.asString(this.renderLocalVars(hash, chunk)));
2123
buf.push("");
@@ -80,21 +82,21 @@ MainTemplate.prototype.renderRequireContent = function(hash, chunk) {
8082
return [
8183
"// Check if module is in cache",
8284
"if(installedModules[moduleId])",
83-
this.indent("return installedModules[moduleId].exports;"),
85+
this.indent("return installedModules[moduleId][exports];"),
8486
"",
8587
"// Create a new module (and put it into the cache)",
8688
"var module = installedModules[moduleId] = {",
8789
this.indent(this.renderModule(hash, chunk, "moduleId")),
8890
"};",
8991
"",
9092
"// Execute the module function",
91-
"modules[moduleId].call(module.exports, module, module.exports, " + this.renderRequireFunctionForModule(hash, chunk, "moduleId") + ");",
93+
"modules[moduleId].call(module[exports], module, module[exports], " + this.renderRequireFunctionForModule(hash, chunk, "moduleId") + ");",
9294
"",
9395
"// Flag the module as loaded",
9496
"module.loaded = true;",
9597
"",
9698
"// Return the exports of the module",
97-
"return module.exports;"
99+
"return module[exports];"
98100
];
99101
};
100102

0 commit comments

Comments
 (0)