Skip to content

Commit 47bb540

Browse files
chore: fix examples (#20780)
1 parent 390333f commit 47bb540

68 files changed

Lines changed: 823 additions & 765 deletions

File tree

Some content is hidden

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

examples/aggressive-merging/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ module.exports = config;
6565
## Unoptimized
6666

6767
```
68-
asset pageA.bundle.js 9.07 KiB [emitted] (name: pageA)
69-
asset pageB.bundle.js 9.07 KiB [emitted] (name: pageB)
70-
asset pageC.bundle.js 9.07 KiB [emitted] (name: pageC)
68+
asset pageA.bundle.js 9.06 KiB [emitted] (name: pageA)
69+
asset pageB.bundle.js 9.06 KiB [emitted] (name: pageB)
70+
asset pageC.bundle.js 9.06 KiB [emitted] (name: pageC)
7171
asset 531.chunk.js 6.28 KiB [emitted]
7272
asset 78.chunk.js 581 bytes [emitted]
7373
chunk (runtime: pageC) 78.chunk.js 42 bytes [rendered]

examples/asset-svg-data-uri/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ module.exports = config;
8989
!*** ./images/file.svg ***!
9090
\*************************/
9191
/*! default exports */
92-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
93-
/*! other exports [not provided] [no usage info] */
92+
/*! exports [not provided] [no usage info] */
9493
/*! runtime requirements: module */
9594
/***/ ((module) => {
9695

@@ -114,12 +113,6 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e"
114113
/******/ if (cachedModule !== undefined) {
115114
/******/ return cachedModule.exports;
116115
/******/ }
117-
/******/ // Check if module exists (development only)
118-
/******/ if (__webpack_modules__[moduleId] === undefined) {
119-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
120-
/******/ e.code = 'MODULE_NOT_FOUND';
121-
/******/ throw e;
122-
/******/ }
123116
/******/ // Create a new module (and put it into the cache)
124117
/******/ var module = __webpack_module_cache__[moduleId] = {
125118
/******/ // no module.id needed
@@ -128,6 +121,12 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e"
128121
/******/ };
129122
/******/
130123
/******/ // Execute the module function
124+
/******/ if (!(moduleId in __webpack_modules__)) {
125+
/******/ delete __webpack_module_cache__[moduleId];
126+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
127+
/******/ e.code = 'MODULE_NOT_FOUND';
128+
/******/ throw e;
129+
/******/ }
131130
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
132131
/******/
133132
/******/ // Return the exports of the module
@@ -203,7 +202,7 @@ function createImageElement(title, src) {
203202
## webpack output
204203

205204
```
206-
asset output.js 4.17 KiB [emitted] (name: main)
205+
asset output.js 4.06 KiB [emitted] (name: main)
207206
chunk (runtime: main) output.js (main) 1.54 KiB (javascript) 274 bytes (runtime) [entry] [rendered]
208207
> ./example.js main
209208
dependent modules 915 bytes [dependent] 1 module

examples/asset/README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ module.exports = config;
158158
!*** ./images/file.png ***!
159159
\*************************/
160160
/*! default exports */
161-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
162-
/*! other exports [not provided] [no usage info] */
161+
/*! exports [not provided] [no usage info] */
163162
/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
164163
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
165164

@@ -171,8 +170,7 @@ module.exports = __webpack_require__.p + "images/89a353e9c515885abd8e.png";
171170
!*** ./images/file.jpg ***!
172171
\*************************/
173172
/*! default exports */
174-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
175-
/*! other exports [not provided] [no usage info] */
173+
/*! exports [not provided] [no usage info] */
176174
/*! runtime requirements: module */
177175
/***/ ((module) => {
178176

@@ -184,8 +182,7 @@ module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAA...4CD/9M//Z"
184182
!*** ./images/file.svg ***!
185183
\*************************/
186184
/*! default exports */
187-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
188-
/*! other exports [not provided] [no usage info] */
185+
/*! exports [not provided] [no usage info] */
189186
/*! runtime requirements: module */
190187
/***/ ((module) => {
191188

@@ -209,8 +206,7 @@ module.exports = __webpack_require__.p + "images/afc10c70ed4ce2b33593.svg";
209206
!*** ./content/file.text ***!
210207
\***************************/
211208
/*! default exports */
212-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
213-
/*! other exports [not provided] [no usage info] */
209+
/*! exports [not provided] [no usage info] */
214210
/*! runtime requirements: module */
215211
/***/ ((module) => {
216212

@@ -222,8 +218,7 @@ module.exports = "a Ā 𐀀 文 🦄 Text\n";
222218
!*** ./content/bytes.svg ***!
223219
\***************************/
224220
/*! default exports */
225-
/*! export default [not provided] [no usage info] [missing usage info prevents renaming] */
226-
/*! other exports [not provided] [no usage info] */
221+
/*! exports [not provided] [no usage info] */
227222
/*! runtime requirements: __webpack_require__.*, __webpack_require__.tb, module */
228223
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
229224

@@ -247,12 +242,6 @@ module.exports = __webpack_require__.tb("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmc
247242
/******/ if (cachedModule !== undefined) {
248243
/******/ return cachedModule.exports;
249244
/******/ }
250-
/******/ // Check if module exists (development only)
251-
/******/ if (__webpack_modules__[moduleId] === undefined) {
252-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
253-
/******/ e.code = 'MODULE_NOT_FOUND';
254-
/******/ throw e;
255-
/******/ }
256245
/******/ // Create a new module (and put it into the cache)
257246
/******/ var module = __webpack_module_cache__[moduleId] = {
258247
/******/ // no module.id needed
@@ -261,6 +250,12 @@ module.exports = __webpack_require__.tb("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmc
261250
/******/ };
262251
/******/
263252
/******/ // Execute the module function
253+
/******/ if (!(moduleId in __webpack_modules__)) {
254+
/******/ delete __webpack_module_cache__[moduleId];
255+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
256+
/******/ e.code = 'MODULE_NOT_FOUND';
257+
/******/ throw e;
258+
/******/ }
264259
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
265260
/******/
266261
/******/ // Return the exports of the module
@@ -290,19 +285,28 @@ module.exports = __webpack_require__.tb("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmc
290285
/******/ /* webpack/runtime/to binary */
291286
/******/ (() => {
292287
/******/ // define to binary helper
288+
/******/ const toImmutableBytes = (value) => {
289+
/******/ var {buffer} = value;
290+
/******/ const throwErr = () => {
291+
/******/ throw new TypeError('ArrayBuffer is immutable');
292+
/******/ };
293+
/******/ Object.defineProperties(buffer, { immutable: { value: true }, resize: { value: throwErr }, transfer: { value: throwErr }, transferToFixedLength: { value: throwErr } });
294+
/******/ Object.freeze(buffer);
295+
/******/ return value;
296+
/******/ }
293297
/******/ __webpack_require__.tb = (() => {
294-
/******/ var table = new Uint8Array(128);
298+
/******/ const table = new Uint8Array(128);
295299
/******/ for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
296300
/******/ return (base64) => {
297-
/******/ var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3 / 4 | 0);
301+
/******/ const n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3 / 4 | 0);
298302
/******/ for (var i = 0, j = 0; i < n;) {
299-
/******/ var c0 = table[base64.charCodeAt(i++)], c1 = table[base64.charCodeAt(i++)];
300-
/******/ var c2 = table[base64.charCodeAt(i++)], c3 = table[base64.charCodeAt(i++)];
303+
/******/ const c0 = table[base64.charCodeAt(i++)], c1 = table[base64.charCodeAt(i++)];
304+
/******/ const c2 = table[base64.charCodeAt(i++)], c3 = table[base64.charCodeAt(i++)];
301305
/******/ bytes[j++] = (c0 << 2) | (c1 >> 4);
302306
/******/ bytes[j++] = (c1 << 4) | (c2 >> 2);
303307
/******/ bytes[j++] = (c2 << 6) | c3;
304308
/******/ }
305-
/******/ return bytes
309+
/******/ return toImmutableBytes(bytes)
306310
/******/ }
307311
/******/ })();
308312
/******/ })();
@@ -490,10 +494,10 @@ files.forEach(item => {
490494
asset output.js 20 KiB [emitted] (name: main)
491495
asset images/89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
492496
asset images/afc10c70ed4ce2b33593.svg 656 bytes [emitted] [immutable] [from: images/url.svg] (auxiliary name: main)
493-
chunk (runtime: main) output.js (main) 12.4 KiB (javascript) 15.2 KiB (asset) 1.48 KiB (runtime) [entry] [rendered]
497+
chunk (runtime: main) output.js (main) 12.4 KiB (javascript) 15.2 KiB (asset) 1.85 KiB (runtime) [entry] [rendered]
494498
> ./example.js main
495499
dependent modules 9.59 KiB (javascript) 15.2 KiB (asset) [dependent] 6 modules
496-
runtime modules 1.48 KiB 5 modules
500+
runtime modules 1.85 KiB 5 modules
497501
./example.js 2.85 KiB [built] [code generated]
498502
[no exports]
499503
[used exports unknown]

examples/build-common.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ const extraArgs = "";
2323

2424
const globalObj = /** @type {typeof globalThis & GlobalObj} */ (global);
2525

26-
const targetArgs = globalObj
26+
const targetArgs = globalObj.NO_TARGET_ARGS
2727
? ""
2828
: "--entry ./example.js --output-filename output.js";
29-
const displayReasons = globalObj
29+
const displayReasons = globalObj.NO_REASONS
3030
? ""
3131
: "--stats-reasons --stats-used-exports --stats-provided-exports";
32-
const statsArgs = globalObj
32+
const statsArgs = globalObj.NO_STATS_OPTIONS
3333
? ""
3434
: "--stats-chunks --stats-modules-space 99999 --stats-chunk-origins";
3535
const publicPathArgs = globalObj.NO_PUBLIC_PATH
@@ -39,6 +39,7 @@ const statsColorsArg = globalObj.STATS_COLORS ? "" : "--no-color";
3939

4040
const commonArgs = `${statsColorsArg} ${statsArgs} ${publicPathArgs} ${extraArgs} ${targetArgs}`;
4141

42+
4243
let readme = fs.readFileSync(
4344
require("path").join(process.cwd(), "template.md"),
4445
"utf8"

examples/build-http/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = config;
4040
## Unoptimized
4141

4242
```
43-
asset output.js 82.7 KiB [emitted] (name: main)
43+
asset output.js 82.6 KiB [emitted] (name: main)
4444
runtime modules 670 bytes 3 modules
4545
modules by path https:// 30 KiB
4646
modules by path https://jspm.dev/ 16.1 KiB 12 modules

examples/chunkhash/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ module.exports = config;
7979
/******/ if (cachedModule !== undefined) {
8080
/******/ return cachedModule.exports;
8181
/******/ }
82-
/******/ // Check if module exists (development only)
83-
/******/ if (__webpack_modules__[moduleId] === undefined) {
84-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
85-
/******/ e.code = 'MODULE_NOT_FOUND';
86-
/******/ throw e;
87-
/******/ }
8882
/******/ // Create a new module (and put it into the cache)
8983
/******/ var module = __webpack_module_cache__[moduleId] = {
9084
/******/ // no module.id needed
@@ -93,6 +87,12 @@ module.exports = config;
9387
/******/ };
9488
/******/
9589
/******/ // Execute the module function
90+
/******/ if (!(moduleId in __webpack_modules__)) {
91+
/******/ delete __webpack_module_cache__[moduleId];
92+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
93+
/******/ e.code = 'MODULE_NOT_FOUND';
94+
/******/ throw e;
95+
/******/ }
9696
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
9797
/******/
9898
/******/ // Return the exports of the module

examples/cjs-tree-shaking/README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,30 +213,42 @@ inc2(a); // 2
213213

214214
```
215215
asset output.js 3.43 KiB [emitted] (name: main)
216-
./example.js 277 bytes [built] [code generated]
217-
./increment.js 251 bytes [built] [code generated]
218-
./math.js 313 bytes [built] [code generated]
216+
chunk (runtime: main) output.js (main) 841 bytes [entry] [rendered]
217+
> ./example.js main
218+
dependent modules 564 bytes [dependent] 2 modules
219+
./example.js 277 bytes [built] [code generated]
220+
[no exports used]
221+
entry ./example.js main
219222
webpack X.X.X compiled successfully
220223
221224
asset without.js 3.57 KiB [emitted] (name: main)
222-
./example.js 277 bytes [built] [code generated]
223-
./increment.js 251 bytes [built] [code generated]
224-
./math.js 313 bytes [built] [code generated]
225+
chunk (runtime: main) without.js (main) 841 bytes [entry] [rendered]
226+
> ./example.js main
227+
dependent modules 564 bytes [dependent] 2 modules
228+
./example.js 277 bytes [built] [code generated]
229+
[used exports unknown]
230+
entry ./example.js main
225231
webpack X.X.X compiled successfully
226232
```
227233

228234
## Production mode
229235

230236
```
231237
asset output.js 543 bytes [emitted] [minimized] (name: main) 1 related asset
232-
./example.js 277 bytes [built] [code generated]
233-
./increment.js 251 bytes [built] [code generated]
234-
./math.js 313 bytes [built] [code generated]
238+
chunk (runtime: main) output.js (main) 841 bytes [entry] [rendered]
239+
> ./example.js main
240+
dependent modules 564 bytes [dependent] 2 modules
241+
./example.js 277 bytes [built] [code generated]
242+
[no exports used]
243+
entry ./example.js main
235244
webpack X.X.X compiled successfully
236245
237246
asset without.js 711 bytes [emitted] [minimized] (name: main) 1 related asset
238-
./example.js 277 bytes [built] [code generated]
239-
./increment.js 251 bytes [built] [code generated]
240-
./math.js 313 bytes [built] [code generated]
247+
chunk (runtime: main) without.js (main) 841 bytes [entry] [rendered]
248+
> ./example.js main
249+
dependent modules 564 bytes [dependent] 2 modules
250+
./example.js 277 bytes [built] [code generated]
251+
[used exports unknown]
252+
entry ./example.js main
241253
webpack X.X.X compiled successfully
242254
```

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ getTemplate("b", function(b) {
3535
/******/ if (cachedModule !== undefined) {
3636
/******/ return cachedModule.exports;
3737
/******/ }
38-
/******/ // Check if module exists (development only)
39-
/******/ if (__webpack_modules__[moduleId] === undefined) {
40-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
41-
/******/ e.code = 'MODULE_NOT_FOUND';
42-
/******/ throw e;
43-
/******/ }
4438
/******/ // Create a new module (and put it into the cache)
4539
/******/ var module = __webpack_module_cache__[moduleId] = {
4640
/******/ // no module.id needed
@@ -49,6 +43,12 @@ getTemplate("b", function(b) {
4943
/******/ };
5044
/******/
5145
/******/ // Execute the module function
46+
/******/ if (!(moduleId in __webpack_modules__)) {
47+
/******/ delete __webpack_module_cache__[moduleId];
48+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
49+
/******/ e.code = 'MODULE_NOT_FOUND';
50+
/******/ throw e;
51+
/******/ }
5252
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
5353
/******/
5454
/******/ // Return the exports of the module
@@ -346,7 +346,7 @@ module.exports = function() {
346346
## Unoptimized
347347

348348
```
349-
asset output.js 9.25 KiB [emitted] (name: main)
349+
asset output.js 9.24 KiB [emitted] (name: main)
350350
asset require_context_templates_sync_recursive_.output.js 2.27 KiB [emitted]
351351
chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.92 KiB (runtime) [entry] [rendered]
352352
> ./example.js main

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ getTemplate("b", function(b) {
3535
/******/ if (cachedModule !== undefined) {
3636
/******/ return cachedModule.exports;
3737
/******/ }
38-
/******/ // Check if module exists (development only)
39-
/******/ if (__webpack_modules__[moduleId] === undefined) {
40-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
41-
/******/ e.code = 'MODULE_NOT_FOUND';
42-
/******/ throw e;
43-
/******/ }
4438
/******/ // Create a new module (and put it into the cache)
4539
/******/ var module = __webpack_module_cache__[moduleId] = {
4640
/******/ // no module.id needed
@@ -49,6 +43,12 @@ getTemplate("b", function(b) {
4943
/******/ };
5044
/******/
5145
/******/ // Execute the module function
46+
/******/ if (!(moduleId in __webpack_modules__)) {
47+
/******/ delete __webpack_module_cache__[moduleId];
48+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
49+
/******/ e.code = 'MODULE_NOT_FOUND';
50+
/******/ throw e;
51+
/******/ }
5252
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
5353
/******/
5454
/******/ // Return the exports of the module
@@ -346,7 +346,7 @@ module.exports = function() {
346346
## Unoptimized
347347

348348
```
349-
asset output.js 9.16 KiB [emitted] (name: main)
349+
asset output.js 9.15 KiB [emitted] (name: main)
350350
asset require_context_templates_sync_recursive_.output.js 2.27 KiB [emitted]
351351
chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.92 KiB (runtime) [entry] [rendered]
352352
> ./example.js main

0 commit comments

Comments
 (0)