@@ -82,7 +82,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
8282 return this . asString ( [
8383 "if(installedChunks[chunkId] === 0)" ,
8484 this . indent ( [
85- "return Promise.resolve()"
85+ "return Promise.resolve(); "
8686 ] ) ,
8787 "" ,
8888 "// an Promise means \"currently loading\"." ,
@@ -112,7 +112,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
112112 "" ,
113113 "// install a JSONP callback for chunk loading" ,
114114 "var parentJsonpFunction = window[" + JSON . stringify ( jsonpFunction ) + "];" ,
115- "window[" + JSON . stringify ( jsonpFunction ) + "] = function webpackJsonpCallback(chunkIds, moreModules, executeModule ) {" ,
115+ "window[" + JSON . stringify ( jsonpFunction ) + "] = function webpackJsonpCallback(chunkIds, moreModules, executeModules ) {" ,
116116 this . indent ( [
117117 "// add \"moreModules\" to the modules object," ,
118118 "// then flag all \"chunkIds\" as loaded and fire callback" ,
@@ -126,17 +126,26 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
126126 ] ) ,
127127 "}" ,
128128 "for(moduleId in moreModules) {" ,
129- this . indent ( this . renderAddModule ( hash , chunk , "moduleId" , "moreModules[moduleId]" ) ) ,
129+ this . indent ( [
130+ "if(Object.prototype.hasOwnProperty.call(moreModules, moduleId))" ,
131+ this . indent ( this . renderAddModule ( hash , chunk , "moduleId" , "moreModules[moduleId]" ) ) ,
132+ ] ) ,
130133 "}" ,
131- "if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);" ,
134+ "if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules );" ,
132135 "while(resolves.length)" ,
133- this . indent ( "resolves.shift()();" ) , ( this . entryPointInChildren ( chunk ) ? [
134- "if(executeModule + 1) { // typeof executeModule === \"number\"" ,
136+ this . indent ( "resolves.shift()();" ) ,
137+ this . entryPointInChildren ( chunk ) ? [
138+ "if(executeModules) {" ,
135139 this . indent ( [
136- "return " + this . requireFn + "(executeModule);"
140+ "for(moduleId in executeModules) {" ,
141+ this . indent ( [
142+ "if(Object.prototype.hasOwnProperty.call(executeModules, moduleId))" ,
143+ this . indent ( "return " + this . requireFn + "(moduleId);" )
144+ ] ) ,
145+ "}"
137146 ] ) ,
138147 "}"
139- ] : "" )
148+ ] : ""
140149 ] ) ,
141150 "};"
142151 ] ) ;
0 commit comments