Skip to content
Permalink
Browse files
install Promise early in chunk cache
IE executes script very early when cached

fixes #4472
  • Loading branch information
sokra committed Mar 21, 2017
1 parent 0c137cb commit 23e1f7c8c94fa76adbbd510200485a65c63ecb07
@@ -92,18 +92,20 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
"return installedChunks[chunkId][2];"
]),
"}",
"// start chunk loading",
"var head = document.getElementsByTagName('head')[0];",
this.applyPluginsWaterfall("jsonp-script", "", chunk, hash),
"",
"// setup Promise in chunk cache",
"var promise = new Promise(function(resolve, reject) {",
this.indent([
"installedChunks[chunkId] = [resolve, reject];"
]),
"});",
"installedChunks[chunkId][2] = promise;",
"",
"// start chunk loading",
"var head = document.getElementsByTagName('head')[0];",
this.applyPluginsWaterfall("jsonp-script", "", chunk, hash),
"head.appendChild(script);",
"",
"return promise;"
]);
});
@@ -6,7 +6,7 @@ cd45585186d59208602b.js 1.96 kB 1 [emitted]
6b94c231e016c5aaccdb.js 1.94 kB 2 [emitted]
fd0985cee894c4f3f1a6.js 1.94 kB 3 [emitted]
d9fc46873c8ea924b895.js 979 bytes 4 [emitted]
beecea47f9a8ded3c298.js 7.41 kB 6 [emitted] main
beecea47f9a8ded3c298.js 7.46 kB 6 [emitted] main
b08c507d4e1e05cbab45.js 985 bytes 9 [emitted]
5d50e858fe6e559aa47c.js 977 bytes 11 [emitted]
Entrypoint main = beecea47f9a8ded3c298.js
@@ -4,7 +4,7 @@ Time: Xms
0.bundle.js 238 bytes 0 [emitted]
1.bundle.js 108 bytes 1 [emitted]
2.bundle.js 204 bytes 2 [emitted]
bundle.js 6.05 kB 3 [emitted] main
bundle.js 6.1 kB 3 [emitted] main
chunk {0} 0.bundle.js 54 bytes {3} [rendered]
> [5] (webpack)/test/statsCases/chunks/index.js 3:0-16
[2] (webpack)/test/statsCases/chunks/c.js 54 bytes {0} [built]
@@ -2,7 +2,7 @@ Hash: dc6038bec87a57d1a45e
Time: Xms
Asset Size Chunks Chunk Names
entry-1.js 25 bytes 0 [emitted] entry-1
vendor-1.js 6.7 kB 1 [emitted] vendor-1
vendor-1.js 6.76 kB 1 [emitted] vendor-1
chunk {0} entry-1.js (entry-1) 0 bytes {1} [initial] [rendered]
chunk {1} vendor-1.js (vendor-1) 329 bytes [entry] [rendered]
[0] (webpack)/test/statsCases/commons-chunk-min-size-0/modules/a.js 22 bytes {1} [built]
@@ -16,7 +16,7 @@ Child
Time: Xms
Asset Size Chunks Chunk Names
0.bundle.js 592 bytes 0 [emitted]
bundle.js 6.06 kB 1 [emitted] main
bundle.js 6.12 kB 1 [emitted] main
chunk {0} 0.bundle.js 118 bytes {1} [rendered]
[0] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built]
[1] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built]
@@ -31,7 +31,7 @@ Child
Asset Size Chunks Chunk Names
0.bundle.js 445 bytes 0 [emitted]
1.bundle.js 204 bytes 1 [emitted]
bundle.js 6.05 kB 2 [emitted] main
bundle.js 6.11 kB 2 [emitted] main
chunk {0} 0.bundle.js 74 bytes {2} [rendered]
[0] (webpack)/test/statsCases/limit-chunk-count-plugin/a.js 22 bytes {0} [built]
[2] (webpack)/test/statsCases/limit-chunk-count-plugin/c.js 30 bytes {0} [built]
@@ -48,7 +48,7 @@ Child
0.bundle.js 204 bytes 0 [emitted]
1.bundle.js 195 bytes 1 [emitted]
2.bundle.js 283 bytes 2 [emitted]
bundle.js 6.04 kB 3 [emitted] main
bundle.js 6.09 kB 3 [emitted] main
chunk {0} 0.bundle.js 44 bytes {2} {3} [rendered]
[1] (webpack)/test/statsCases/limit-chunk-count-plugin/b.js 22 bytes {0} [built]
[4] (webpack)/test/statsCases/limit-chunk-count-plugin/e.js 22 bytes {0} [built]
@@ -8,7 +8,7 @@ Time: Xms
4.js 140 bytes 4, 6 [emitted] chunk
5.js 306 bytes 5, 3 [emitted] cir2 from cir1
6.js 80 bytes 6 [emitted] ac in ab
main.js 6.72 kB 7 [emitted] main
main.js 6.77 kB 7 [emitted] main
chunk {0} 0.js (cir1) 81 bytes {3} {5} {7} [rendered]
> duplicate cir1 from cir2 [3] (webpack)/test/statsCases/optimize-chunks/circular2.js 1:0-79
> duplicate cir1 [7] (webpack)/test/statsCases/optimize-chunks/index.js 13:0-54
@@ -4,7 +4,7 @@ Time: Xms
0.js 238 bytes 0 [emitted]
1.js 108 bytes 1 [emitted]
2.js 204 bytes 2 [emitted]
main.js 6.04 kB 3 [emitted] main
main.js 6.09 kB 3 [emitted] main
Entrypoint main = main.js
chunk {0} 0.js 54 bytes {3} [rendered]
[2] (webpack)/test/statsCases/preset-verbose/c.js 54 bytes {0} [depth 1] [built]

0 comments on commit 23e1f7c

Please sign in to comment.