Skip to content

Commit 3455d7b

Browse files
committed
update examples
1 parent 463eeb5 commit 3455d7b

File tree

43 files changed

+3270
-3389
lines changed

Some content is hidden

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

43 files changed

+3270
-3389
lines changed

examples/aggressive-merging/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ module.exports = {
5757

5858
```
5959
Hash: 75bcce350a8b5f748873
60-
Version: webpack 2.6.0
60+
Version: webpack 3.0.0-rc.0
6161
Asset Size Chunks Chunk Names
6262
0.chunk.js 5.76 kB 0 [emitted]
63-
1.chunk.js 401 bytes 1 [emitted]
64-
pageB.bundle.js 6.58 kB 2 [emitted] pageB
65-
pageA.bundle.js 6.55 kB 3 [emitted] pageA
66-
pageC.bundle.js 6.34 kB 4 [emitted] pageC
63+
1.chunk.js 403 bytes 1 [emitted]
64+
pageB.bundle.js 6.42 kB 2 [emitted] pageB
65+
pageA.bundle.js 6.39 kB 3 [emitted] pageA
66+
pageC.bundle.js 6.18 kB 4 [emitted] pageC
6767
Entrypoint pageA = pageA.bundle.js
6868
Entrypoint pageB = pageB.bundle.js
6969
Entrypoint pageC = pageC.bundle.js
@@ -102,13 +102,13 @@ chunk {4} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
102102

103103
```
104104
Hash: 75bcce350a8b5f748873
105-
Version: webpack 2.6.0
105+
Version: webpack 3.0.0-rc.0
106106
Asset Size Chunks Chunk Names
107107
0.chunk.js 75 bytes 0 [emitted]
108108
1.chunk.js 78 bytes 1 [emitted]
109-
pageB.bundle.js 1.49 kB 2 [emitted] pageB
110-
pageA.bundle.js 1.49 kB 3 [emitted] pageA
111-
pageC.bundle.js 1.47 kB 4 [emitted] pageC
109+
pageB.bundle.js 1.46 kB 2 [emitted] pageB
110+
pageA.bundle.js 1.46 kB 3 [emitted] pageA
111+
pageC.bundle.js 1.44 kB 4 [emitted] pageC
112112
Entrypoint pageA = pageA.bundle.js
113113
Entrypoint pageB = pageB.bundle.js
114114
Entrypoint pageC = pageC.bundle.js

examples/build-common.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,25 @@ var extraArgs = "";
1010

1111
var targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js";
1212
var displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports --display-provided-exports";
13-
(function doIt(remainingTimes) {
14-
cp.exec("node ../../bin/webpack.js" + displayReasons + " --display-chunks --display-modules --display-origins --display-entrypoints --output-public-path \"js/\" -p " + extraArgs + targetArgs, function (error, stdout, stderr) {
15-
if(stderr && remainingTimes === 1)
13+
cp.exec("node ../../bin/webpack.js" + displayReasons + " --display-chunks --display-modules --display-origins --display-entrypoints --output-public-path \"js/\" -p " + extraArgs + targetArgs, function(error, stdout, stderr) {
14+
if(stderr)
15+
console.log(stderr);
16+
if(error !== null)
17+
console.log(error);
18+
try {
19+
var readme = tc.replaceResults(fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8"), process.cwd(), stdout.replace(/[\r\n]*$/, ""), "min");
20+
} catch(e) {
21+
console.log(stderr);
22+
throw e;
23+
}
24+
cp.exec("node ../../bin/webpack.js" + displayReasons + " --display-chunks --display-modules --display-origins --display-entrypoints --output-public-path \"js/\" --output-pathinfo " + extraArgs + targetArgs, function(error, stdout, stderr) {
25+
console.log(stdout);
26+
if(stderr)
1627
console.log(stderr);
17-
if (error !== null && remainingTimes === 1)
28+
if(error !== null)
1829
console.log(error);
19-
try {
20-
var readme = tc.replaceResults(fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8"), process.cwd(), stdout.replace(/[\r\n]*$/, ""), "min");
21-
} catch(e) {
22-
console.log(stderr);
23-
throw e;
24-
}
25-
cp.exec("node ../../bin/webpack.js" + displayReasons + " --display-chunks --display-modules --display-origins --display-entrypoints --output-public-path \"js/\" --output-pathinfo " + extraArgs + targetArgs, function (error, stdout, stderr) {
26-
if(remainingTimes === 1)
27-
console.log(stdout);
28-
if(stderr && remainingTimes === 1)
29-
console.log(stderr);
30-
if (error !== null && remainingTimes === 1)
31-
console.log(error);
32-
readme = tc.replaceResults(readme, process.cwd(), stdout.replace(/[\r\n]*$/, ""));
33-
readme = tc.replaceBase(readme);
34-
fs.writeFile("README.md", readme, "utf-8", function() {});
35-
if(remainingTimes > 1)
36-
doIt(remainingTimes - 1);
37-
});
30+
readme = tc.replaceResults(readme, process.cwd(), stdout.replace(/[\r\n]*$/, ""));
31+
readme = tc.replaceBase(readme);
32+
fs.writeFile("README.md", readme, "utf-8", function() {});
3833
});
39-
}(3));
34+
});

examples/chunkhash/README.md

Lines changed: 57 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = {
6262

6363
<!-- inlined minimized file "manifest.[chunkhash].js" -->
6464
<script>
65-
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,s=0,l=[];s<t.length;s++)a=t[s],o[a]&&l.push(o[a][0]),o[a]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,u);l.length;)l.shift()();if(u)for(s=0;s<u.length;s++)f=n(n.s=u[s]);return f};var t={},o={4:0},c=new Promise(function(e){e()});n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(a);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return c;if(o[e])return o[e][2];var t=new Promise(function(n,r){o[e]=[n,r]});o[e][2]=t;var u=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+{0:"d1359b519c10df30787b",1:"06459c375ec851b0e2ae",2:"4d752abc2fcf569f13fc",3:"8d8564a703e7631bff4b"}[e]+".js";var a=setTimeout(r,12e4);return i.onerror=i.onload=r,u.appendChild(i),t},n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},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,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="js/",n.oe=function(e){throw console.error(e),e}}([]);
65+
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var u,i,f,d=0,s=[];d<t.length;d++)i=t[d],o[i]&&s.push(o[i][0]),o[i]=0;for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(e[u]=c[u]);for(r&&r(t,c,a);s.length;)s.shift()();if(a)for(d=0;d<a.length;d++)f=n(n.s=a[d]);return f};var t={},o={4:0};n.e=function(e){function r(){u.onerror=u.onload=null,clearTimeout(i);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var a=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=12e4,n.nc&&u.setAttribute("nonce",n.nc),u.src=n.p+""+{0:"3db3fdaf96bbdadce99a",1:"7c1138cf80dd374c367e",2:"543257d0ba12aefbc71b",3:"15bdf078724c793dc604"}[e]+".js";var i=setTimeout(r,12e4);return u.onerror=u.onload=r,a.appendChild(u),c},n.m=e,n.c=t,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},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,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="js/",n.oe=function(e){throw console.error(e),e}}([]);
6666
</script>
6767

6868
<!-- optional when using the CommonChunkPlugin for vendor modules -->
@@ -79,11 +79,11 @@ module.exports = {
7979
``` javascript
8080
webpackJsonp([2],[
8181
/* 0 */
82-
/* exports provided: default */
83-
/* all exports used */
8482
/*!*******************!*\
8583
!*** ./vendor.js ***!
8684
\*******************/
85+
/*! exports provided: default */
86+
/*! all exports used */
8787
/***/ (function(module, __webpack_exports__, __webpack_require__) {
8888

8989
"use strict";
@@ -94,116 +94,113 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
9494

9595
/***/ }),
9696
/* 1 */,
97-
/* 2 */,
98-
/* 3 */,
99-
/* 4 */
100-
/* unknown exports provided */
101-
/* all exports used */
97+
/* 2 */
10298
/*!**********************!*\
10399
!*** multi ./vendor ***!
104100
\**********************/
101+
/*! no static exports found */
102+
/*! all exports used */
105103
/***/ (function(module, exports, __webpack_require__) {
106104

107105
module.exports = __webpack_require__(/*! ./vendor */0);
108106

109107

110108
/***/ })
111-
],[4]);
109+
],[2]);
112110
```
113111

114112
# js/main.[chunkhash].js
115113

116114
``` javascript
117-
webpackJsonp([3],{
118-
119-
/***/ 3:
120-
/* unknown exports provided */
121-
/* all exports used */
115+
webpackJsonp([3],[
116+
/* 0 */,
117+
/* 1 */
122118
/*!********************!*\
123119
!*** ./example.js ***!
124120
\********************/
121+
/*! no static exports found */
122+
/*! all exports used */
125123
/***/ (function(module, __webpack_exports__, __webpack_require__) {
126124

127125
"use strict";
128126
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
129127
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__vendor__ = __webpack_require__(/*! ./vendor */ 0);
130128

131129
// some module
132-
__webpack_require__.e/* import() */(1).then(__webpack_require__.bind(null, /*! ./async1 */ 1));
133-
__webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, /*! ./async2 */ 2));
130+
__webpack_require__.e/* import() */(1).then(__webpack_require__.bind(null, /*! ./async1 */ 3));
131+
__webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, /*! ./async2 */ 4));
134132

135133

136134
/***/ })
137-
138-
},[3]);
135+
],[1]);
139136
```
140137

141138
# Info
142139

143140
## Uncompressed
144141

145142
```
146-
Hash: ea635224271deb1b32d9
147-
Version: webpack 2.6.0
143+
Hash: 49023fec553882c3285c
144+
Version: webpack 3.0.0-rc.0
148145
Asset Size Chunks Chunk Names
149-
d1359b519c10df30787b.js 237 bytes 0 [emitted]
150-
06459c375ec851b0e2ae.js 243 bytes 1 [emitted]
151-
common.[chunkhash].js 747 bytes 2 [emitted] common
152-
main.[chunkhash].js 654 bytes 3 [emitted] main
153-
manifest.[chunkhash].js 6.05 kB 4 [emitted] manifest
146+
3db3fdaf96bbdadce99a.js 238 bytes 0 [emitted]
147+
7c1138cf80dd374c367e.js 238 bytes 1 [emitted]
148+
common.[chunkhash].js 732 bytes 2 [emitted] common
149+
main.[chunkhash].js 661 bytes 3 [emitted] main
150+
manifest.[chunkhash].js 5.89 kB 4 [emitted] manifest
154151
Entrypoint main = manifest.[chunkhash].js common.[chunkhash].js main.[chunkhash].js
155152
Entrypoint common = manifest.[chunkhash].js common.[chunkhash].js
156-
chunk {0} d1359b519c10df30787b.js 29 bytes {3} [rendered]
157-
> [3] ./example.js 4:0-18
158-
[2] ./async2.js 29 bytes {0} [built]
159-
import() ./async2 [3] ./example.js 4:0-18
160-
chunk {1} 06459c375ec851b0e2ae.js 29 bytes {3} [rendered]
161-
> [3] ./example.js 3:0-18
162-
[1] ./async1.js 29 bytes {1} [built]
163-
import() ./async1 [3] ./example.js 3:0-18
153+
chunk {0} 3db3fdaf96bbdadce99a.js 29 bytes {3} [rendered]
154+
> [1] ./example.js 4:0-18
155+
[4] ./async2.js 29 bytes {0} [built]
156+
import() ./async2 [1] ./example.js 4:0-18
157+
chunk {1} 7c1138cf80dd374c367e.js 29 bytes {3} [rendered]
158+
> [1] ./example.js 3:0-18
159+
[3] ./async1.js 29 bytes {1} [built]
160+
import() ./async1 [1] ./example.js 3:0-18
164161
chunk {2} common.[chunkhash].js (common) 97 bytes {4} [initial] [rendered]
165-
> common [4] multi ./vendor
162+
> common [2] multi ./vendor
166163
[0] ./vendor.js 69 bytes {2} [built]
167164
[exports: default]
168-
harmony import ./vendor [3] ./example.js 1:0-30
169-
single entry ./vendor [4] multi ./vendor common:100000
170-
[4] multi ./vendor 28 bytes {2} [built]
165+
harmony import ./vendor [1] ./example.js 1:0-30
166+
single entry ./vendor [2] multi ./vendor common:100000
167+
[2] multi ./vendor 28 bytes {2} [built]
171168
chunk {3} main.[chunkhash].js (main) 90 bytes {2} [initial] [rendered]
172-
> main [3] ./example.js
173-
[3] ./example.js 90 bytes {3} [built]
169+
> main [1] ./example.js
170+
[1] ./example.js 90 bytes {3} [built]
174171
chunk {4} manifest.[chunkhash].js (manifest) 0 bytes [entry] [rendered]
175172
```
176173

177174
## Minimized (uglify-js, no zip)
178175

179176
```
180-
Hash: ea635224271deb1b32d9
181-
Version: webpack 2.6.0
177+
Hash: 49023fec553882c3285c
178+
Version: webpack 3.0.0-rc.0
182179
Asset Size Chunks Chunk Names
183-
d1359b519c10df30787b.js 38 bytes 0 [emitted]
184-
06459c375ec851b0e2ae.js 37 bytes 1 [emitted]
185-
common.[chunkhash].js 152 bytes 2 [emitted] common
186-
main.[chunkhash].js 166 bytes 3 [emitted] main
187-
manifest.[chunkhash].js 1.49 kB 4 [emitted] manifest
180+
3db3fdaf96bbdadce99a.js 38 bytes 0 [emitted]
181+
7c1138cf80dd374c367e.js 38 bytes 1 [emitted]
182+
common.[chunkhash].js 150 bytes 2 [emitted] common
183+
main.[chunkhash].js 165 bytes 3 [emitted] main
184+
manifest.[chunkhash].js 1.46 kB 4 [emitted] manifest
188185
Entrypoint main = manifest.[chunkhash].js common.[chunkhash].js main.[chunkhash].js
189186
Entrypoint common = manifest.[chunkhash].js common.[chunkhash].js
190-
chunk {0} d1359b519c10df30787b.js 29 bytes {3} [rendered]
191-
> [3] ./example.js 4:0-18
192-
[2] ./async2.js 29 bytes {0} [built]
193-
import() ./async2 [3] ./example.js 4:0-18
194-
chunk {1} 06459c375ec851b0e2ae.js 29 bytes {3} [rendered]
195-
> [3] ./example.js 3:0-18
196-
[1] ./async1.js 29 bytes {1} [built]
197-
import() ./async1 [3] ./example.js 3:0-18
187+
chunk {0} 3db3fdaf96bbdadce99a.js 29 bytes {3} [rendered]
188+
> [1] ./example.js 4:0-18
189+
[4] ./async2.js 29 bytes {0} [built]
190+
import() ./async2 [1] ./example.js 4:0-18
191+
chunk {1} 7c1138cf80dd374c367e.js 29 bytes {3} [rendered]
192+
> [1] ./example.js 3:0-18
193+
[3] ./async1.js 29 bytes {1} [built]
194+
import() ./async1 [1] ./example.js 3:0-18
198195
chunk {2} common.[chunkhash].js (common) 97 bytes {4} [initial] [rendered]
199-
> common [4] multi ./vendor
196+
> common [2] multi ./vendor
200197
[0] ./vendor.js 69 bytes {2} [built]
201198
[exports: default]
202-
harmony import ./vendor [3] ./example.js 1:0-30
203-
single entry ./vendor [4] multi ./vendor common:100000
204-
[4] multi ./vendor 28 bytes {2} [built]
199+
harmony import ./vendor [1] ./example.js 1:0-30
200+
single entry ./vendor [2] multi ./vendor common:100000
201+
[2] multi ./vendor 28 bytes {2} [built]
205202
chunk {3} main.[chunkhash].js (main) 90 bytes {2} [initial] [rendered]
206-
> main [3] ./example.js
207-
[3] ./example.js 90 bytes {3} [built]
203+
> main [1] ./example.js
204+
[1] ./example.js 90 bytes {3} [built]
208205
chunk {4} manifest.[chunkhash].js (manifest) 0 bytes [entry] [rendered]
209206
```

0 commit comments

Comments
 (0)