Skip to content

Commit 4d82a9d

Browse files
author
Stefan Schneider
committed
Added more missing {} around if and while in templates
1 parent 8b3e587 commit 4d82a9d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎lib/JsonpMainTemplatePlugin.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,23 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
7171
"var chunk = installedChunks[chunkId];",
7272
"if(chunk !== 0) {",
7373
this.indent([
74-
"if(chunk) chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));",
74+
"if(chunk) {",
75+
this.indent("chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));"),
76+
"}",
7577
"installedChunks[chunkId] = undefined;"
7678
]),
7779
"}"
7880
]),
79-
"};",
81+
"};"
8082
]);
8183
});
8284
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
8385
return this.asString([
84-
"if(installedChunks[chunkId] === 0)",
86+
"if(installedChunks[chunkId] === 0) {",
8587
this.indent([
8688
"return Promise.resolve();"
8789
]),
88-
"",
90+
"}",
8991
"// a Promise means \"currently loading\".",
9092
"if(installedChunks[chunkId]) {",
9193
this.indent([
@@ -134,8 +136,9 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
134136
"for(;i < chunkIds.length; i++) {",
135137
this.indent([
136138
"chunkId = chunkIds[i];",
137-
"if(installedChunks[chunkId])",
139+
"if(installedChunks[chunkId]) {",
138140
this.indent("resolves.push(installedChunks[chunkId][0]);"),
141+
"}",
139142
"installedChunks[chunkId] = 0;"
140143
]),
141144
"}",
@@ -147,8 +150,9 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
147150
]),
148151
"}",
149152
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);",
150-
"while(resolves.length)",
153+
"while(resolves.length) {",
151154
this.indent("resolves.shift()();"),
155+
"}",
152156
this.entryPointInChildren(chunk) ? [
153157
"if(executeModules) {",
154158
this.indent([

0 commit comments

Comments
 (0)