@@ -19,9 +19,7 @@ class JsonpMainTemplatePlugin {
1919 this . indent (
2020 chunk . ids . map ( id => `${ JSON . stringify ( id ) } : 0` ) . join ( ",\n" )
2121 ) ,
22- "};" ,
23- "" ,
24- "var resolvedPromise = new Promise(function(resolve) { resolve(); });"
22+ "};"
2523 ] ) ;
2624 }
2725 return source ;
@@ -81,26 +79,27 @@ class JsonpMainTemplatePlugin {
8179 } ) ;
8280 mainTemplate . plugin ( "require-ensure" , function ( _ , chunk , hash ) {
8381 return this . asString ( [
84- "if(installedChunks[chunkId] === 0) {" ,
82+ "var installedChunkData = installedChunks[chunkId];" ,
83+ "if(installedChunkData === 0) {" ,
8584 this . indent ( [
86- "return resolvedPromise ;"
85+ "return new Promise(function(resolve) { resolve(); }) ;"
8786 ] ) ,
8887 "}" ,
8988 "" ,
9089 "// a Promise means \"currently loading\"." ,
91- "if(installedChunks[chunkId] ) {" ,
90+ "if(installedChunkData ) {" ,
9291 this . indent ( [
93- "return installedChunks[chunkId] [2];"
92+ "return installedChunkData [2];"
9493 ] ) ,
9594 "}" ,
9695 "" ,
9796 "// setup Promise in chunk cache" ,
9897 "var promise = new Promise(function(resolve, reject) {" ,
9998 this . indent ( [
100- "installedChunks[chunkId] = [resolve, reject];"
99+ "installedChunkData = installedChunks[chunkId] = [resolve, reject];"
101100 ] ) ,
102101 "});" ,
103- "installedChunks[chunkId] [2] = promise;" ,
102+ "installedChunkData [2] = promise;" ,
104103 "" ,
105104 "// start chunk loading" ,
106105 "var head = document.getElementsByTagName('head')[0];" ,
0 commit comments