Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 2, 2019
1 parent 5a9d029 commit ff8946e
Show file tree
Hide file tree
Showing 45 changed files with 316 additions and 249 deletions.
16 changes: 8 additions & 8 deletions examples/aggressive-merging/README.md
Expand Up @@ -60,13 +60,13 @@ module.exports = {

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
0.chunk.js 5.96 KiB 0 [emitted]
4.chunk.js 405 bytes 4 [emitted]
pageA.bundle.js 8.28 KiB 1 [emitted] pageA
pageB.bundle.js 8.28 KiB 2 [emitted] pageB
pageC.bundle.js 8.28 KiB 3 [emitted] pageC
pageA.bundle.js 8.5 KiB 1 [emitted] pageA
pageB.bundle.js 8.5 KiB 2 [emitted] pageB
pageC.bundle.js 8.5 KiB 3 [emitted] pageC
Entrypoint pageA = pageA.bundle.js
Entrypoint pageB = pageB.bundle.js
Entrypoint pageC = pageC.bundle.js
Expand Down Expand Up @@ -108,13 +108,13 @@ chunk {4} 4.chunk.js 42 bytes <{3}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
0.chunk.js 173 bytes 0, 4 [emitted]
4.chunk.js 118 bytes 4 [emitted]
pageA.bundle.js 2.03 KiB 1 [emitted] pageA
pageB.bundle.js 2.03 KiB 2 [emitted] pageB
pageC.bundle.js 2.05 KiB 3 [emitted] pageC
pageA.bundle.js 2.11 KiB 1 [emitted] pageA
pageB.bundle.js 2.11 KiB 2 [emitted] pageB
pageC.bundle.js 2.12 KiB 3 [emitted] pageC
Entrypoint pageA = pageA.bundle.js
Entrypoint pageB = pageB.bundle.js
Entrypoint pageC = pageC.bundle.js
Expand Down
18 changes: 11 additions & 7 deletions examples/chunkhash/README.md
Expand Up @@ -43,7 +43,7 @@ module.exports = {
<body>
<!-- inlined minimized file "runtime~main.[chunkhash].js" -->
<script>
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+".[chunkhash].js"}(e),u=function(r){a.onerror=a.onload=null,clearTimeout(c);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src,i=new Error("Loading chunk "+e+" failed.\n("+n+": "+u+")");i.type=n,i.request=u,t[1](i)}o[e]=void 0}};var c=setTimeout(function(){u({type:"timeout",target:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="dist/",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+".[chunkhash].js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout(function(){u({type:"timeout",target:a})},12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="dist/",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
</script>

<script src="dist/main.[chunkhash].js"></script>
Expand All @@ -68,7 +68,7 @@ module.exports = {
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
Expand Down Expand Up @@ -104,6 +104,7 @@ module.exports = {
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
/******/ }
/******/ }
/******/
/******/ return result;
/******/ }
/******/
Expand Down Expand Up @@ -180,6 +181,8 @@ module.exports = {
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
Expand All @@ -189,7 +192,8 @@ module.exports = {
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ var error = new Error('Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')');
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
Expand Down Expand Up @@ -308,12 +312,12 @@ __webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(null, /

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
2.[chunkhash].js 269 bytes 2 [emitted]
3.[chunkhash].js 263 bytes 3 [emitted]
main.[chunkhash].js 485 bytes 1 [emitted] main
runtime~main.[chunkhash].js 8.71 KiB 0 [emitted] runtime~main
runtime~main.[chunkhash].js 8.94 KiB 0 [emitted] runtime~main
Entrypoint main = runtime~main.[chunkhash].js main.[chunkhash].js
chunk {0} runtime~main.[chunkhash].js (runtime~main) 0 bytes ={1}= >{2}< >{3}< [entry] [rendered]
> ./example main
Expand All @@ -335,12 +339,12 @@ chunk {3} 3.[chunkhash].js 28 bytes <{0}> <{1}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
2.[chunkhash].js 77 bytes 2 [emitted]
3.[chunkhash].js 78 bytes 3 [emitted]
main.[chunkhash].js 149 bytes 0 [emitted] main
runtime~main.[chunkhash].js 2.13 KiB 1 [emitted] runtime~main
runtime~main.[chunkhash].js 2.21 KiB 1 [emitted] runtime~main
Entrypoint main = runtime~main.[chunkhash].js main.[chunkhash].js
chunk {0} main.[chunkhash].js (main) 55 bytes ={1}= >{2}< >{3}< [initial] [rendered]
> ./example main
Expand Down
15 changes: 9 additions & 6 deletions examples/code-splitted-require.context-amd/README.md
Expand Up @@ -31,7 +31,7 @@ getTemplate("b", function(b) {
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
Expand Down Expand Up @@ -123,6 +123,8 @@ getTemplate("b", function(b) {
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
Expand All @@ -132,7 +134,8 @@ getTemplate("b", function(b) {
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ var error = new Error('Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')');
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
Expand Down Expand Up @@ -333,10 +336,10 @@ module.exports = function() {

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 1.81 KiB 1 [emitted]
output.js 8.41 KiB 0 [emitted] main
output.js 8.63 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 251 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand All @@ -361,10 +364,10 @@ chunk {1} 1.output.js 457 bytes <{0}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 621 bytes 1 [emitted]
output.js 2.12 KiB 0 [emitted] main
output.js 2.2 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 251 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand Down
15 changes: 9 additions & 6 deletions examples/code-splitted-require.context/README.md
Expand Up @@ -31,7 +31,7 @@ getTemplate("b", function(b) {
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
Expand Down Expand Up @@ -123,6 +123,8 @@ getTemplate("b", function(b) {
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
Expand All @@ -132,7 +134,8 @@ getTemplate("b", function(b) {
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ var error = new Error('Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')');
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
Expand Down Expand Up @@ -333,10 +336,10 @@ module.exports = function() {

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 1.81 KiB 1 [emitted]
output.js 8.35 KiB 0 [emitted] main
output.js 8.57 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 266 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand All @@ -361,10 +364,10 @@ chunk {1} 1.output.js 457 bytes <{0}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 621 bytes 1 [emitted]
output.js 2.1 KiB 0 [emitted] main
output.js 2.18 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 266 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand Down
15 changes: 9 additions & 6 deletions examples/code-splitting-bundle-loader/README.md
Expand Up @@ -33,7 +33,7 @@ module.exports = "It works";
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
Expand Down Expand Up @@ -125,6 +125,8 @@ module.exports = "It works";
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
Expand All @@ -134,7 +136,8 @@ module.exports = "It works";
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ var error = new Error('Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')');
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
Expand Down Expand Up @@ -289,10 +292,10 @@ module.exports = "It works";

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 257 bytes 1 [emitted]
output.js 8.78 KiB 0 [emitted] main
output.js 9 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 375 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand All @@ -310,10 +313,10 @@ chunk {1} 1.output.js 28 bytes <{0}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
1.output.js 98 bytes 1 [emitted]
output.js 2.16 KiB 0 [emitted] main
output.js 2.24 KiB 0 [emitted] main
Entrypoint main = output.js
chunk {0} output.js (main) 375 bytes >{1}< [entry] [rendered]
> ./example.js main
Expand Down
15 changes: 9 additions & 6 deletions examples/code-splitting-harmony/README.md
Expand Up @@ -41,7 +41,7 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
/******/ var moduleId, chunkId, i = 0, resolves = [];
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
Expand Down Expand Up @@ -133,6 +133,8 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
/******/ }
/******/ script.src = jsonpScriptSrc(chunkId);
/******/
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ onScriptComplete = function (event) {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
Expand All @@ -142,7 +144,8 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
/******/ if(chunk) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ var error = new Error('Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')');
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ chunk[1](error);
Expand Down Expand Up @@ -327,12 +330,12 @@ module.exports = webpackAsyncContext;

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
0.output.js 275 bytes 0 [emitted]
1.output.js 284 bytes 1 [emitted]
3.output.js 270 bytes 3 [emitted]
output.js 9.72 KiB 2 [emitted] main
output.js 9.94 KiB 2 [emitted] main
Entrypoint main = output.js
chunk {0} 0.output.js 13 bytes <{2}> [rendered]
> ./1 [4] ./node_modules/c lazy ^\.\/.*$ namespace object ./1
Expand All @@ -359,12 +362,12 @@ chunk {3} 3.output.js 11 bytes <{2}> [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 4.29.6
Version: webpack 4.39.0
Asset Size Chunks Chunk Names
0.output.js 76 bytes 0 [emitted]
1.output.js 77 bytes 1 [emitted]
3.output.js 78 bytes 3 [emitted]
output.js 2.53 KiB 2 [emitted] main
output.js 2.61 KiB 2 [emitted] main
Entrypoint main = output.js
chunk {0} 0.output.js 13 bytes <{2}> [rendered]
> ./1 [4] ./node_modules/c lazy ^\.\/.*$ namespace object ./1
Expand Down

0 comments on commit ff8946e

Please sign in to comment.