@@ -43,6 +43,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
4343 chunkNameMap [ c . id ] = c . name || undefined ;
4444 c . chunks . forEach ( addChunk ) ;
4545 } ( chunk ) ) ;
46+ var renderedHash = this . renderCurrentHashCode ( hash ) ;
4647 return this . asString ( [
4748 "// \"0\" is the signal for \"already loaded\"" ,
4849 "if(installedChunks[chunkId] === 0)" ,
@@ -62,7 +63,10 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
6263 "script.async = true;" ,
6364 "script.src = " + this . requireFn + ".p + " +
6465 this . applyPluginsWaterfall ( "asset-path" , JSON . stringify ( chunkFilename ) , {
65- hash : "\" + " + this . renderCurrentHashCode ( hash ) + " + \"" ,
66+ hash : "\" + " + renderedHash + " + \"" ,
67+ hashWithLength : function ( length ) {
68+ return "\" + " + renderedHash . slice ( 0 , length ) + " + \"" ;
69+ } ,
6670 chunk : {
6771 id : "\" + chunkId + \"" ,
6872 hash : "\" + " + JSON . stringify ( chunkHashMap ) + "[chunkId] + \"" ,
@@ -127,14 +131,21 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
127131 var hotUpdateChunkFilename = this . outputOptions . hotUpdateChunkFilename ;
128132 var hotUpdateMainFilename = this . outputOptions . hotUpdateMainFilename ;
129133 var hotUpdateFunction = this . outputOptions . hotUpdateFunction || Template . toIdentifier ( "webpackHotUpdate" + ( this . outputOptions . library || "" ) ) ;
134+ var renderedHash = this . renderCurrentHashCode ( hash ) ;
130135 var currentHotUpdateChunkFilename = this . applyPluginsWaterfall ( "asset-path" , JSON . stringify ( hotUpdateChunkFilename ) , {
131- hash : "\" + " + this . renderCurrentHashCode ( hash ) + " + \"" ,
136+ hash : "\" + " + renderedHash + " + \"" ,
137+ hashWithLength : function ( length ) {
138+ return "\" + " + renderedHash . slice ( 0 , length ) + " + \"" ;
139+ } ,
132140 chunk : {
133141 id : "\" + chunkId + \""
134142 }
135143 } ) ;
136144 var currentHotUpdateMainFilename = this . applyPluginsWaterfall ( "asset-path" , JSON . stringify ( hotUpdateMainFilename ) , {
137- hash : "\" + " + this . renderCurrentHashCode ( hash ) + " + \""
145+ hash : "\" + " + renderedHash + " + \"" ,
146+ hashWithLength : function ( length ) {
147+ return "\" + " + renderedHash . slice ( 0 , length ) + " + \"" ;
148+ }
138149 } ) ;
139150 return source + "\n" +
140151 "var parentHotUpdateCallback = this[" + JSON . stringify ( hotUpdateFunction ) + "];\n" +
0 commit comments