File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,6 +318,7 @@ var hotInitCode = Template.getFunctionContent(function() {
318318 var hotWaitingFiles = 0 ;
319319 var hotChunksLoading = 0 ;
320320 var hotWaitingFilesMap = { } ;
321+ var hotRequestedFilesMap = { } ;
321322 var hotAvailibleFilesMap = { } ;
322323 var hotCallback ;
323324
@@ -336,6 +337,7 @@ var hotInitCode = Template.getFunctionContent(function() {
336337 return ;
337338 }
338339
340+ hotRequestedFilesMap = { } ;
339341 hotAvailibleFilesMap = { } ;
340342 hotWaitingFilesMap = { } ;
341343 for ( var i = 0 ; i < update . c . length ; i ++ )
@@ -355,6 +357,9 @@ var hotInitCode = Template.getFunctionContent(function() {
355357 }
356358
357359 function hotAddUpdateChunk ( chunkId , moreModules ) {
360+ if ( ! hotAvailibleFilesMap [ chunkId ] || ! hotRequestedFilesMap [ chunkId ] )
361+ return ;
362+ hotRequestedFilesMap [ chunkId ] = false ;
358363 for ( var moduleId in moreModules ) {
359364 hotUpdate [ moduleId ] = moreModules [ moduleId ] ;
360365 }
@@ -367,6 +372,7 @@ var hotInitCode = Template.getFunctionContent(function() {
367372 if ( ! hotAvailibleFilesMap [ chunkId ] ) {
368373 hotWaitingFilesMap [ chunkId ] = true ;
369374 } else {
375+ hotRequestedFilesMap [ chunkId ] = true ;
370376 hotWaitingFiles ++ ;
371377 hotDownloadUpdateChunk ( chunkId ) ;
372378 }
Original file line number Diff line number Diff line change @@ -120,9 +120,12 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
120120 . replace ( Template . REGEXP_ID , "\" + chunkId + \"" ) ;
121121 var currentHotUpdateMainFilename = JSON . stringify ( hotUpdateMainFilename )
122122 . replace ( Template . REGEXP_HASH , "\" + " + this . renderCurrentHashCode ( hash ) + " + \"" ) ;
123- return source + "\nthis[" + JSON . stringify ( hotUpdateFunction ) + "] = " + Template . getFunctionContent ( function ( ) {
123+ return source + "\n" +
124+ "var parentHotUpdateCallback = this[" + JSON . stringify ( hotUpdateFunction ) + "];\n" +
125+ "this[" + JSON . stringify ( hotUpdateFunction ) + "] = " + Template . getFunctionContent ( function ( ) {
124126 function webpackHotUpdateCallback ( chunkId , moreModules ) {
125127 hotAddUpdateChunk ( chunkId , moreModules ) ;
128+ if ( parentHotUpdateCallback ) parentHotUpdateCallback ( chunkId , moreModules ) ;
126129 }
127130
128131 function hotDownloadUpdateChunk ( chunkId ) {
You can’t perform that action at this time.
0 commit comments