@@ -26,26 +26,13 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
2626 }
2727 return source ;
2828 } ) ;
29- mainTemplate . plugin ( "require-ensure " , function ( _ , chunk , hash ) {
29+ mainTemplate . plugin ( "jsonp-script " , function ( _ , chunk , hash ) {
3030 var filename = this . outputOptions . filename ;
3131 var chunkFilename = this . outputOptions . chunkFilename ;
3232 var chunkMaps = chunk . getChunkMaps ( ) ;
3333 var crossOriginLoading = this . outputOptions . crossOriginLoading ;
3434 var chunkLoadTimeout = this . outputOptions . chunkLoadTimeout || 120000 ;
3535 return this . asString ( [
36- "if(installedChunks[chunkId] === 0)" ,
37- this . indent ( [
38- "return Promise.resolve()"
39- ] ) ,
40- "" ,
41- "// an Promise means \"currently loading\"." ,
42- "if(installedChunks[chunkId]) {" ,
43- this . indent ( [
44- "return installedChunks[chunkId][2];"
45- ] ) ,
46- "}" ,
47- "// start chunk loading" ,
48- "var head = document.getElementsByTagName('head')[0];" ,
4936 "var script = document.createElement('script');" ,
5037 "script.type = 'text/javascript';" ,
5138 "script.charset = 'utf-8';" ,
@@ -88,6 +75,25 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
8875 "}"
8976 ] ) ,
9077 "};" ,
78+ ] ) ;
79+ } ) ;
80+ mainTemplate . plugin ( "require-ensure" , function ( _ , chunk , hash ) {
81+ var chunkFilename = this . outputOptions . chunkFilename ;
82+ return this . asString ( [
83+ "if(installedChunks[chunkId] === 0)" ,
84+ this . indent ( [
85+ "return Promise.resolve()"
86+ ] ) ,
87+ "" ,
88+ "// an Promise means \"currently loading\"." ,
89+ "if(installedChunks[chunkId]) {" ,
90+ this . indent ( [
91+ "return installedChunks[chunkId][2];"
92+ ] ) ,
93+ "}" ,
94+ "// start chunk loading" ,
95+ "var head = document.getElementsByTagName('head')[0];" ,
96+ this . applyPluginsWaterfall ( "jsonp-script" , "" , chunk , hash ) ,
9197 "head.appendChild(script);" ,
9298 "" ,
9399 "var promise = new Promise(function(resolve, reject) {" ,
0 commit comments