Skip to content

Commit 2722bfa

Browse files
committed
WIP17
1 parent a0b91cc commit 2722bfa

File tree

45 files changed

+1345
-1065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1345
-1065
lines changed

examples/aggressive-merging/README.md

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ module.exports = {
4545
},
4646
plugins: [
4747
new AggressiveMergingPlugin({
48-
minSizeReduce: 1.5,
49-
moveToParents: true
48+
minSizeReduce: 1.5
5049
})
5150
],
5251
optimization: {
@@ -63,44 +62,44 @@ module.exports = {
6362
Hash: 0a1b2c3d4e5f6a7b8c9d
6463
Version: webpack next
6564
Asset Size Chunks Chunk Names
66-
0.chunk.js 5.65 KiB 0 [emitted]
65+
0.chunk.js 5.98 KiB 0 [emitted]
6766
1.chunk.js 405 bytes 1 [emitted]
68-
pageC.bundle.js 7.02 KiB 2 [emitted] pageC
69-
pageB.bundle.js 7.23 KiB 3 [emitted] pageB
70-
pageA.bundle.js 7.21 KiB 4 [emitted] pageA
67+
pageC.bundle.js 7.05 KiB 2 [emitted] pageC
68+
pageB.bundle.js 7.05 KiB 3 [emitted] pageB
69+
pageA.bundle.js 7.05 KiB 4 [emitted] pageA
7170
Entrypoint pageA = pageA.bundle.js
7271
Entrypoint pageB = pageB.bundle.js
7372
Entrypoint pageC = pageC.bundle.js
74-
chunk {0} 0.chunk.js 5.42 KiB {3} {4} [rendered]
75-
> aggressive-merge [5] ./pageA.js 1:0-3:2
76-
> aggressive-merge [4] ./pageB.js 1:0-3:2
73+
chunk {0} 0.chunk.js 5.46 KiB <{3}> <{4}> [rendered]
74+
> ./common [4] ./pageB.js 1:0-3:2
75+
> ./common [5] ./pageA.js 1:0-3:2
76+
[0] ./b.js 21 bytes {0} {1} [built]
77+
cjs require ./b [3] ./pageC.js 2:17-31
78+
cjs require ./b [4] ./pageB.js 2:8-22
79+
[1] ./a.js 21 bytes {0} {1} [built]
80+
amd require ./a [3] ./pageC.js 1:0-3:2
81+
cjs require ./a [5] ./pageA.js 2:8-22
7782
[2] ./common.js 5.42 KiB {0} [built]
7883
amd require ./common [4] ./pageB.js 1:0-3:2
7984
amd require ./common [5] ./pageA.js 1:0-3:2
80-
chunk {1} 1.chunk.js 42 bytes {2} [rendered]
81-
> [3] ./pageC.js 1:0-3:2
82-
[0] ./b.js 21 bytes {1} {3} [built]
85+
chunk {1} 1.chunk.js 42 bytes <{2}> [rendered]
86+
> ./a [3] ./pageC.js 1:0-3:2
87+
[0] ./b.js 21 bytes {0} {1} [built]
8388
cjs require ./b [3] ./pageC.js 2:17-31
8489
cjs require ./b [4] ./pageB.js 2:8-22
85-
[1] ./a.js 21 bytes {1} {4} [built]
90+
[1] ./a.js 21 bytes {0} {1} [built]
8691
amd require ./a [3] ./pageC.js 1:0-3:2
8792
cjs require ./a [5] ./pageA.js 2:8-22
88-
chunk {2} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
89-
> pageC [3] ./pageC.js
93+
chunk {2} pageC.bundle.js (pageC) 70 bytes >{1}< [entry] [rendered]
94+
> ./pageC pageC
9095
[3] ./pageC.js 70 bytes {2} [built]
9196
single entry ./pageC pageC
92-
chunk {3} pageB.bundle.js (pageB) 92 bytes [entry] [rendered]
93-
> pageB [4] ./pageB.js
94-
[0] ./b.js 21 bytes {1} {3} [built]
95-
cjs require ./b [3] ./pageC.js 2:17-31
96-
cjs require ./b [4] ./pageB.js 2:8-22
97+
chunk {3} pageB.bundle.js (pageB) 71 bytes >{0}< [entry] [rendered]
98+
> ./pageB pageB
9799
[4] ./pageB.js 71 bytes {3} [built]
98100
single entry ./pageB pageB
99-
chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
100-
> pageA [5] ./pageA.js
101-
[1] ./a.js 21 bytes {1} {4} [built]
102-
amd require ./a [3] ./pageC.js 1:0-3:2
103-
cjs require ./a [5] ./pageA.js 2:8-22
101+
chunk {4} pageA.bundle.js (pageA) 71 bytes >{0}< [entry] [rendered]
102+
> ./pageA pageA
104103
[5] ./pageA.js 71 bytes {4} [built]
105104
single entry ./pageA pageA
106105
```
@@ -111,44 +110,44 @@ chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
111110
Hash: 0a1b2c3d4e5f6a7b8c9d
112111
Version: webpack next
113112
Asset Size Chunks Chunk Names
114-
0.chunk.js 115 bytes 0 [emitted]
113+
0.chunk.js 173 bytes 0, 1 [emitted]
115114
1.chunk.js 118 bytes 1 [emitted]
116-
pageC.bundle.js 1.67 KiB 2 [emitted] pageC
117-
pageB.bundle.js 1.69 KiB 3 [emitted] pageB
118-
pageA.bundle.js 1.69 KiB 4 [emitted] pageA
115+
pageC.bundle.js 1.68 KiB 2 [emitted] pageC
116+
pageB.bundle.js 1.66 KiB 3 [emitted] pageB
117+
pageA.bundle.js 1.66 KiB 4 [emitted] pageA
119118
Entrypoint pageA = pageA.bundle.js
120119
Entrypoint pageB = pageB.bundle.js
121120
Entrypoint pageC = pageC.bundle.js
122-
chunk {0} 0.chunk.js 5.42 KiB {3} {4} [rendered]
123-
> aggressive-merge [5] ./pageA.js 1:0-3:2
124-
> aggressive-merge [4] ./pageB.js 1:0-3:2
121+
chunk {0} 0.chunk.js 5.46 KiB <{3}> <{4}> [rendered]
122+
> ./common [4] ./pageB.js 1:0-3:2
123+
> ./common [5] ./pageA.js 1:0-3:2
124+
[0] ./b.js 21 bytes {0} {1} [built]
125+
cjs require ./b [3] ./pageC.js 2:17-31
126+
cjs require ./b [4] ./pageB.js 2:8-22
127+
[1] ./a.js 21 bytes {0} {1} [built]
128+
amd require ./a [3] ./pageC.js 1:0-3:2
129+
cjs require ./a [5] ./pageA.js 2:8-22
125130
[2] ./common.js 5.42 KiB {0} [built]
126131
amd require ./common [4] ./pageB.js 1:0-3:2
127132
amd require ./common [5] ./pageA.js 1:0-3:2
128-
chunk {1} 1.chunk.js 42 bytes {2} [rendered]
129-
> [3] ./pageC.js 1:0-3:2
130-
[0] ./b.js 21 bytes {1} {3} [built]
133+
chunk {1} 1.chunk.js 42 bytes <{2}> [rendered]
134+
> ./a [3] ./pageC.js 1:0-3:2
135+
[0] ./b.js 21 bytes {0} {1} [built]
131136
cjs require ./b [3] ./pageC.js 2:17-31
132137
cjs require ./b [4] ./pageB.js 2:8-22
133-
[1] ./a.js 21 bytes {1} {4} [built]
138+
[1] ./a.js 21 bytes {0} {1} [built]
134139
amd require ./a [3] ./pageC.js 1:0-3:2
135140
cjs require ./a [5] ./pageA.js 2:8-22
136-
chunk {2} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
137-
> pageC [3] ./pageC.js
141+
chunk {2} pageC.bundle.js (pageC) 70 bytes >{1}< [entry] [rendered]
142+
> ./pageC pageC
138143
[3] ./pageC.js 70 bytes {2} [built]
139144
single entry ./pageC pageC
140-
chunk {3} pageB.bundle.js (pageB) 92 bytes [entry] [rendered]
141-
> pageB [4] ./pageB.js
142-
[0] ./b.js 21 bytes {1} {3} [built]
143-
cjs require ./b [3] ./pageC.js 2:17-31
144-
cjs require ./b [4] ./pageB.js 2:8-22
145+
chunk {3} pageB.bundle.js (pageB) 71 bytes >{0}< [entry] [rendered]
146+
> ./pageB pageB
145147
[4] ./pageB.js 71 bytes {3} [built]
146148
single entry ./pageB pageB
147-
chunk {4} pageA.bundle.js (pageA) 92 bytes [entry] [rendered]
148-
> pageA [5] ./pageA.js
149-
[1] ./a.js 21 bytes {1} {4} [built]
150-
amd require ./a [3] ./pageC.js 1:0-3:2
151-
cjs require ./a [5] ./pageA.js 2:8-22
149+
chunk {4} pageA.bundle.js (pageA) 71 bytes >{0}< [entry] [rendered]
150+
> ./pageA pageA
152151
[5] ./pageA.js 71 bytes {4} [built]
153152
single entry ./pageA pageA
154153
```

examples/buildAll.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ const cmds = examples.map(function(dirname) {
77
return "cd " + dirname + " && node build.js";
88
});
99

10+
let failed = 0;
1011
let i = 0;
1112
for(const cmd of cmds) {
1213
console.log(`[${++i}/${cmds.length}] ${cmd}`);
13-
cp.execSync(cmd, { encoding: "utf-8" });
14+
try {
15+
cp.execSync(cmd, { encoding: "utf-8" });
16+
} catch(e) {
17+
failed++;
18+
console.log(e);
19+
}
1420
}
1521
console.log("done");
22+
if(failed > 0)
23+
console.log(`${failed} failed`);

examples/chunkhash/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353

5454
<!-- inlined minimized file "manifest.[chunkhash].js" -->
5555
<script>
56-
!function(e){function r(r){for(var n,o,i=r[0],c=r[1],l=r[2],p=0,f=[];p<i.length;p++)o=i[p],u[o]&&f.push(u[o][0]),u[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(s&&s(r);f.length;)f.shift()();return a.push.apply(a,l||[]),t()}function t(){var e;for(c=0;c<a.length;c++){for(var r=a[c],t=!0,o=1;o<r.length;o++){var i=r[o];0!==u[i]&&(t=!1)}t&&(a.splice(c--,1),e=n(n.s=r[0]))}return e}function n(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var o={},u={2:0},a=[];n.e=function(e){var r=[],t=u[e];if(0!==t)if(t)r.push(t[2]);else{var o=new Promise(function(r,n){t=u[e]=[r,n]});r.push(t[2]=o);var a=document.getElementsByTagName("head")[0],i=document.createElement("script");i.charset="utf-8",i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+({}[e]||e)+".[chunkhash].js";var c=setTimeout(function(){s({type:"timeout",target:i})},12e4);i.onerror=i.onload=s;function s(r){i.onerror=i.onload=null,clearTimeout(c);var t=u[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src,a=new Error("Loading chunk "+e+" failed.\n("+n+": "+o+")");a.type=n,a.request=o,t[1](a)}u[e]=void 0}}a.appendChild(i)}return Promise.all(r)},n.m=e,n.c=o,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="dist/",n.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[];i.push=r,i=i.slice();for(var c=0;c<i.length;c++)r(i[c]);var s=i.push.bind(i);t()}([]);
56+
!function(e){function r(r){for(var n,o,i=r[0],c=r[1],s=r[2],p=0,f=[];p<i.length;p++)o=i[p],u[o]&&f.push(u[o][0]),u[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);f.length;)f.shift()();return a.push.apply(a,s||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],o=!0,i=1;i<t.length;i++){var c=t[i];0!==u[c]&&(o=!1)}o&&(a.splice(r--,1),e=n(n.s=t[0]))}return e}function n(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var o={},u={2:0},a=[];n.e=function(e){var r=[],t=u[e];if(0!==t)if(t)r.push(t[2]);else{var o=new Promise(function(r,n){t=u[e]=[r,n]});r.push(t[2]=o);var a=document.getElementsByTagName("head")[0],i=document.createElement("script");i.charset="utf-8",i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+({}[e]||e)+".[chunkhash].js";var c=setTimeout(function(){s({type:"timeout",target:i})},12e4);i.onerror=i.onload=s;function s(r){i.onerror=i.onload=null,clearTimeout(c);var t=u[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src,a=new Error("Loading chunk "+e+" failed.\n("+n+": "+o+")");a.type=n,a.request=o,t[1](a)}u[e]=void 0}}a.appendChild(i)}return Promise.all(r)},n.m=e,n.c=o,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="dist/",n.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var s=0;s<i.length;s++)r(i[s]);var l=c;t()}([]);
5757
</script>
5858

5959
<!-- optional when using the CommonChunkPlugin for vendor modules -->
@@ -104,7 +104,7 @@ module.exports = {
104104
/******/ };
105105
/******/ function checkDeferredModules() {
106106
/******/ var result;
107-
/******/ for(i = 0; i < deferredModules.length; i++) {
107+
/******/ for(var i = 0; i < deferredModules.length; i++) {
108108
/******/ var deferredModule = deferredModules[i];
109109
/******/ var fullfilled = true;
110110
/******/ for(var j = 1; j < deferredModule.length; j++) {
@@ -253,10 +253,11 @@ module.exports = {
253253
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
254254
/******/
255255
/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || [];
256+
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
256257
/******/ jsonpArray.push = webpackJsonpCallback;
257258
/******/ jsonpArray = jsonpArray.slice();
258259
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
259-
/******/ var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);
260+
/******/ var parentJsonpFunction = oldJsonpFunction;
260261
/******/
261262
/******/
262263
/******/ // run deferred modules from other chunks
@@ -315,12 +316,12 @@ __webpack_require__.r(__webpack_exports__);
315316

316317
```
317318
Hash: 0a1b2c3d4e5f6a7b8c9d
318-
Version: webpack 4.0.0-alpha.4
319+
Version: webpack next
319320
Asset Size Chunks Chunk Names
320321
main.[chunkhash].js 1.28 KiB 0 [emitted] main
321322
1.[chunkhash].js 264 bytes 1 [emitted]
322323
2.[chunkhash].js 264 bytes 2 [emitted]
323-
main-runtime.[chunkhash].js 7.43 KiB 3 [emitted] main-runtime
324+
main-runtime.[chunkhash].js 7.49 KiB 3 [emitted] main-runtime
324325
Entrypoint main = main-runtime.[chunkhash].js main.[chunkhash].js
325326
chunk {0} main.[chunkhash].js (main) 159 bytes ={3}= >{1}< >{2}< [initial] [rendered]
326327
> ./example main
@@ -346,7 +347,7 @@ chunk {3} main-runtime.[chunkhash].js (main-runtime) 0 bytes ={0}= >{1}< >{2}
346347

347348
```
348349
Hash: 0a1b2c3d4e5f6a7b8c9d
349-
Version: webpack 4.0.0-alpha.4
350+
Version: webpack next
350351
Asset Size Chunks Chunk Names
351352
0.[chunkhash].js 77 bytes 0 [emitted]
352353
1.[chunkhash].js 78 bytes 1 [emitted]

examples/code-splitted-require.context-amd/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ getTemplate("b", function(b) {
2222
/******/ (function(modules) { // webpackBootstrap
2323
/******/ // install a JSONP callback for chunk loading
2424
/******/ function webpackJsonpCallback(data) {
25-
/******/ var chunkIds = data[0], moreModules = data[1], executeModules = data[2];
25+
/******/ var chunkIds = data[0];
26+
/******/ var moreModules = data[1]
27+
/******/
2628
/******/ // add "moreModules" to the modules object,
2729
/******/ // then flag all "chunkIds" as loaded and fire callback
28-
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
30+
/******/ var moduleId, chunkId, i = 0, resolves = [];
2931
/******/ for(;i < chunkIds.length; i++) {
3032
/******/ chunkId = chunkIds[i];
3133
/******/ if(installedChunks[chunkId]) {
@@ -45,6 +47,7 @@ getTemplate("b", function(b) {
4547
/******/
4648
/******/ };
4749
/******/
50+
/******/
4851
/******/ // The module cache
4952
/******/ var installedModules = {};
5053
/******/
@@ -53,7 +56,7 @@ getTemplate("b", function(b) {
5356
/******/ 1: 0
5457
/******/ };
5558
/******/
56-
/******/ var scheduledModules = [];
59+
/******/
5760
/******/
5861
/******/ // The require function
5962
/******/ function __webpack_require__(moduleId) {
@@ -179,10 +182,12 @@ getTemplate("b", function(b) {
179182
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
180183
/******/
181184
/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || [];
182-
/******/ var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);
185+
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
183186
/******/ jsonpArray.push = webpackJsonpCallback;
184187
/******/ jsonpArray = jsonpArray.slice();
185188
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
189+
/******/ var parentJsonpFunction = oldJsonpFunction;
190+
/******/
186191
/******/
187192
/******/ // Load entry module and return exports
188193
/******/ return __webpack_require__(__webpack_require__.s = 0);
@@ -309,9 +314,9 @@ Hash: 0a1b2c3d4e5f6a7b8c9d
309314
Version: webpack next
310315
Asset Size Chunks Chunk Names
311316
0.output.js 1.86 KiB 0 [emitted]
312-
output.js 7.16 KiB 1 [emitted] main
317+
output.js 7.19 KiB 1 [emitted] main
313318
Entrypoint main = output.js
314-
chunk {0} 0.output.js 463 bytes {1} [rendered]
319+
chunk {0} 0.output.js 463 bytes <{1}> [rendered]
315320
> [0] ./example.js 2:1-4:3
316321
[1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built]
317322
amd require context ../require.context/templates [0] ./example.js 2:1-4:3
@@ -324,8 +329,8 @@ chunk {0} 0.output.js 463 bytes {1} [rendered]
324329
[4] ../require.context/templates/a.js 82 bytes {0} [optional] [built]
325330
context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js
326331
context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a
327-
chunk {1} output.js (main) 261 bytes [entry] [rendered]
328-
> main [0] ./example.js
332+
chunk {1} output.js (main) 261 bytes >{0}< [entry] [rendered]
333+
> .\example.js main
329334
[0] ./example.js 261 bytes {1} [built]
330335
single entry .\example.js main
331336
```
@@ -339,7 +344,7 @@ Version: webpack next
339344
0.output.js 627 bytes 0 [emitted]
340345
output.js 1.75 KiB 1 [emitted] main
341346
Entrypoint main = output.js
342-
chunk {0} 0.output.js 463 bytes {1} [rendered]
347+
chunk {0} 0.output.js 463 bytes <{1}> [rendered]
343348
> [0] ./example.js 2:1-4:3
344349
[1] ../require.context/templates sync ^\.\/.*$ 217 bytes {0} [built]
345350
amd require context ../require.context/templates [0] ./example.js 2:1-4:3
@@ -352,8 +357,8 @@ chunk {0} 0.output.js 463 bytes {1} [rendered]
352357
[4] ../require.context/templates/a.js 82 bytes {0} [optional] [built]
353358
context element ./a.js [1] ../require.context/templates sync ^\.\/.*$ ./a.js
354359
context element ./a [1] ../require.context/templates sync ^\.\/.*$ ./a
355-
chunk {1} output.js (main) 261 bytes [entry] [rendered]
356-
> main [0] ./example.js
360+
chunk {1} output.js (main) 261 bytes >{0}< [entry] [rendered]
361+
> .\example.js main
357362
[0] ./example.js 261 bytes {1} [built]
358363
single entry .\example.js main
359364
```

0 commit comments

Comments
 (0)