Skip to content

Commit aecc297

Browse files
authored
Merge pull request webpack#4610 from con-ssc/master
Added {} in templates
2 parents accc94c + 44091a1 commit aecc297

30 files changed

Lines changed: 52 additions & 45 deletions

File tree

‎lib/JsonpMainTemplatePlugin.js‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ class JsonpMainTemplatePlugin {
6767
"var chunk = installedChunks[chunkId];",
6868
"if(chunk !== 0) {",
6969
this.indent([
70-
"if(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));",
70+
"if(chunk) {",
71+
this.indent("chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));"),
72+
"}",
7173
"installedChunks[chunkId] = undefined;"
7274
]),
7375
"}"
@@ -77,10 +79,11 @@ class JsonpMainTemplatePlugin {
7779
});
7880
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
7981
return this.asString([
80-
"if(installedChunks[chunkId] === 0)",
82+
"if(installedChunks[chunkId] === 0) {",
8183
this.indent([
8284
"return Promise.resolve();"
8385
]),
86+
"}",
8487
"",
8588
"// a Promise means \"currently loading\".",
8689
"if(installedChunks[chunkId]) {",
@@ -131,8 +134,9 @@ class JsonpMainTemplatePlugin {
131134
"for(;i < chunkIds.length; i++) {",
132135
this.indent([
133136
"chunkId = chunkIds[i];",
134-
"if(installedChunks[chunkId])",
137+
"if(installedChunks[chunkId]) {",
135138
this.indent("resolves.push(installedChunks[chunkId][0]);"),
139+
"}",
136140
"installedChunks[chunkId] = 0;"
137141
]),
138142
"}",
@@ -144,8 +148,9 @@ class JsonpMainTemplatePlugin {
144148
]),
145149
"}",
146150
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);",
147-
"while(resolves.length)",
151+
"while(resolves.length) {",
148152
this.indent("resolves.shift()();"),
153+
"}",
149154
this.entryPointInChildren(chunk) ? [
150155
"if(executeModules) {",
151156
this.indent([

‎lib/MainTemplate.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ module.exports = class MainTemplate extends Template {
5757
return this.asString([
5858
source,
5959
"// Check if module is in cache",
60-
"if(installedModules[moduleId])",
60+
"if(installedModules[moduleId]) {",
6161
this.indent("return installedModules[moduleId].exports;"),
62-
"",
62+
"}",
6363
"// Create a new module (and put it into the cache)",
6464
"var module = installedModules[moduleId] = {",
6565
this.indent(this.applyPluginsWaterfall("module-obj", "", chunk, hash, "moduleId")),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
entry: ["react", "react-dom", "lodash"]
3-
}
3+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
entry: "./index"
3-
}
3+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
entry: "./index",
33
devtool: "eval-cheap-module-source-map"
4-
}
4+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
entry: "./index"
3-
}
3+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {};
1+
module.exports = {};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {};
1+
module.exports = {};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {};
1+
module.exports = {};
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
module: {
3-
strictExportPresence: true
4-
}
2+
module: {
3+
strictExportPresence: true
4+
}
55
};

0 commit comments

Comments
 (0)