Skip to content

Commit 84c6449

Browse files
committed
update examples
1 parent 754cda3 commit 84c6449

File tree

13 files changed

+169
-141
lines changed

13 files changed

+169
-141
lines changed

examples/chunkhash/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ __webpack_require__.r(__webpack_exports__);
131131
/* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vendor */0);
132132

133133
// some module
134-
__webpack_require__.e/* import() */(1).then(__webpack_require__.bind(null, /*! ./async1 */3));
135-
__webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, /*! ./async2 */4));
134+
__webpack_require__.e/* import() */(1).then(function() { var m = __webpack_require__(/*! ./async1 */3); return m && typeof m === "object" && m.__esModule ? m : /* fake namespace object */ { "default": m }; });
135+
__webpack_require__.e/* import() */(0).then(function() { var m = __webpack_require__(/*! ./async2 */4); return m && typeof m === "object" && m.__esModule ? m : /* fake namespace object */ { "default": m }; });
136136

137137

138138
/***/ })
@@ -150,7 +150,7 @@ Version: webpack next
150150
d384ba1bbf385fcafc99.js 359 bytes 0 [emitted]
151151
13604ac9ffd7d870f88b.js 359 bytes 1 [emitted]
152152
common.[chunkhash].js 975 bytes 2 [emitted] common
153-
main.[chunkhash].js 741 bytes 3 [emitted] main
153+
main.[chunkhash].js 971 bytes 3 [emitted] main
154154
manifest.[chunkhash].js 7.14 KiB 4 [emitted] manifest
155155
Entrypoint main = manifest.[chunkhash].js common.[chunkhash].js main.[chunkhash].js
156156
Entrypoint common = manifest.[chunkhash].js common.[chunkhash].js
@@ -187,7 +187,7 @@ Version: webpack next
187187
d384ba1bbf385fcafc99.js 78 bytes 0 [emitted]
188188
13604ac9ffd7d870f88b.js 78 bytes 1 [emitted]
189189
common.[chunkhash].js 154 bytes 2 [emitted] common
190-
main.[chunkhash].js 171 bytes 3 [emitted] main
190+
main.[chunkhash].js 301 bytes 3 [emitted] main
191191
manifest.[chunkhash].js 1.81 KiB 4 [emitted] manifest
192192
Entrypoint main = manifest.[chunkhash].js common.[chunkhash].js main.[chunkhash].js
193193
Entrypoint common = manifest.[chunkhash].js common.[chunkhash].js

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ getTemplate("b", function(b) {
203203
/***/ (function(module, exports, __webpack_require__) {
204204

205205
function getTemplate(templateName, callback) {
206-
__webpack_require__.e/* require */(0).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__( 1)("./"+templateName)]; ((function(tmpl) {
206+
__webpack_require__.e/* require */(0).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(/*! ../require.context/templates */ 1)("./"+templateName)]; ((function(tmpl) {
207207
callback(tmpl());
208208
}).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));}).catch(__webpack_require__.oe);
209209
}
@@ -240,15 +240,19 @@ var map = {
240240
"./c": 4,
241241
"./c.js": 4
242242
};
243+
244+
243245
function webpackContext(req) {
244-
return __webpack_require__(webpackContextResolve(req));
245-
};
246+
var id = webpackContextResolve(req);
247+
var module = __webpack_require__(id);
248+
return module;
249+
}
246250
function webpackContextResolve(req) {
247251
var id = map[req];
248252
if(!(id + 1)) // check for number or string
249253
throw new Error("Cannot find module '" + req + "'.");
250254
return id;
251-
};
255+
}
252256
webpackContext.keys = function webpackContextKeys() {
253257
return Object.keys(map);
254258
};
@@ -310,8 +314,8 @@ module.exports = function() {
310314
Hash: 3742c378c8642182b6b1
311315
Version: webpack next
312316
Asset Size Chunks Chunk Names
313-
0.output.js 2.15 KiB 0 [emitted]
314-
output.js 7.24 KiB 1 [emitted] main
317+
0.output.js 2.19 KiB 0 [emitted]
318+
output.js 7.28 KiB 1 [emitted] main
315319
Entrypoint main = output.js
316320
chunk {0} 0.output.js 463 bytes {1} [rendered]
317321
> [0] ./example.js 2:1-4:3
@@ -338,7 +342,7 @@ chunk {1} output.js (main) 261 bytes [entry] [rendered]
338342
Hash: 3742c378c8642182b6b1
339343
Version: webpack next
340344
Asset Size Chunks Chunk Names
341-
0.output.js 584 bytes 0 [emitted]
345+
0.output.js 592 bytes 0 [emitted]
342346
output.js 1.75 KiB 1 [emitted] main
343347
Entrypoint main = output.js
344348
chunk {0} 0.output.js 463 bytes {1} [rendered]

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ getTemplate("b", function(b) {
204204

205205
function getTemplate(templateName, callback) {
206206
__webpack_require__.e/* require.ensure */(0).then((function(require) {
207-
callback(__webpack_require__( 1)("./"+templateName)());
207+
callback(__webpack_require__(/*! ../require.context/templates */ 1)("./"+templateName)());
208208
}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
209209
}
210210
getTemplate("a", function(a) {
@@ -240,15 +240,19 @@ var map = {
240240
"./c": 4,
241241
"./c.js": 4
242242
};
243+
244+
243245
function webpackContext(req) {
244-
return __webpack_require__(webpackContextResolve(req));
245-
};
246+
var id = webpackContextResolve(req);
247+
var module = __webpack_require__(id);
248+
return module;
249+
}
246250
function webpackContextResolve(req) {
247251
var id = map[req];
248252
if(!(id + 1)) // check for number or string
249253
throw new Error("Cannot find module '" + req + "'.");
250254
return id;
251-
};
255+
}
252256
webpackContext.keys = function webpackContextKeys() {
253257
return Object.keys(map);
254258
};
@@ -310,8 +314,8 @@ module.exports = function() {
310314
Hash: 71a61aeef010cd2fd50d
311315
Version: webpack next
312316
Asset Size Chunks Chunk Names
313-
0.output.js 2.15 KiB 0 [emitted]
314-
output.js 7.18 KiB 1 [emitted] main
317+
0.output.js 2.19 KiB 0 [emitted]
318+
output.js 7.22 KiB 1 [emitted] main
315319
Entrypoint main = output.js
316320
chunk {0} 0.output.js 463 bytes {1} [rendered]
317321
> [0] ./example.js 2:1-4:3
@@ -338,7 +342,7 @@ chunk {1} output.js (main) 276 bytes [entry] [rendered]
338342
Hash: 71a61aeef010cd2fd50d
339343
Version: webpack next
340344
Asset Size Chunks Chunk Names
341-
0.output.js 584 bytes 0 [emitted]
345+
0.output.js 592 bytes 0 [emitted]
342346
output.js 1.73 KiB 1 [emitted] main
343347
Entrypoint main = output.js
344348
chunk {0} 0.output.js 463 bytes {1} [rendered]

examples/code-splitting-harmony/README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ __webpack_require__.r(__webpack_exports__);
221221
/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(a__WEBPACK_IMPORTED_MODULE_0__);
222222

223223

224-
__webpack_require__.e/* import() */(2).then(__webpack_require__.bind(null, /*! b */5)).then(function(b) {
224+
__webpack_require__.e/* import() */(2).then(function() { var m = __webpack_require__(/*! b */5); return m && typeof m === "object" && m.__esModule ? m : /* fake namespace object */ { "default": m }; }).then(function(b) {
225225
console.log("b loaded", b);
226226
})
227227

228228
function loadC(name) {
229-
return __webpack_require__( 4)("./" + name);
229+
return __webpack_require__(/*! c */ 4)("./" + name);
230230
}
231231

232232
Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
@@ -247,9 +247,9 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
247247

248248
/***/ }),
249249
/* 4 */
250-
/*!**************************************!*\
251-
!*** ./node_modules/c lazy ^\.\/.*$ ***!
252-
\**************************************/
250+
/*!*******************************************************!*\
251+
!*** ./node_modules/c lazy ^\.\/.*$ namespace object ***!
252+
\*******************************************************/
253253
/*! no static exports found */
254254
/*! all exports used */
255255
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
@@ -276,11 +276,12 @@ var map = {
276276
function webpackAsyncContext(req) {
277277
var ids = map[req];
278278
if(!ids)
279-
return Promise.reject(new Error("Cannot find module '" + req + "'."));
279+
return Promise.resolve().then(function() { throw new Error("Cannot find module '" + req + "'."); });
280280
return __webpack_require__.e(ids[1]).then(function() {
281-
return __webpack_require__(ids[0]);
281+
var module = __webpack_require__(ids[0]);
282+
return typeof module !== "object" || !module.__esModule ? /* fake namespace object */ { "default": module } : module;;
282283
});
283-
};
284+
}
284285
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
285286
return Object.keys(map);
286287
};
@@ -303,7 +304,7 @@ Version: webpack next
303304
0.output.js 379 bytes 0 [emitted]
304305
1.output.js 370 bytes 1 [emitted]
305306
2.output.js 365 bytes 2 [emitted]
306-
output.js 8.53 KiB 3 [emitted] main
307+
output.js 8.85 KiB 3 [emitted] main
307308
Entrypoint main = output.js
308309
chunk {0} 0.output.js 13 bytes {3} [rendered]
309310
1 module
@@ -317,7 +318,7 @@ chunk {3} output.js (main) 427 bytes [entry] [rendered]
317318
[2] ./example.js 256 bytes {3} [built]
318319
[no exports]
319320
single entry .\example.js main
320-
[4] ./node_modules/c lazy ^\.\/.*$ 160 bytes {3} [built]
321+
[4] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built]
321322
import() context lazy c [2] ./example.js 8:8-27
322323
+ 1 hidden module
323324
```
@@ -331,7 +332,7 @@ Version: webpack next
331332
0.output.js 77 bytes 0 [emitted]
332333
1.output.js 76 bytes 1 [emitted]
333334
2.output.js 78 bytes 2 [emitted]
334-
output.js 2.07 KiB 3 [emitted] main
335+
output.js 2.21 KiB 3 [emitted] main
335336
Entrypoint main = output.js
336337
chunk {0} 0.output.js 13 bytes {3} [rendered]
337338
1 module
@@ -345,7 +346,7 @@ chunk {3} output.js (main) 427 bytes [entry] [rendered]
345346
[2] ./example.js 256 bytes {3} [built]
346347
[no exports]
347348
single entry .\example.js main
348-
[4] ./node_modules/c lazy ^\.\/.*$ 160 bytes {3} [built]
349+
[4] ./node_modules/c lazy ^\.\/.*$ namespace object 160 bytes {3} [built]
349350
import() context lazy c [2] ./example.js 8:8-27
350351
+ 1 hidden module
351352
```

examples/code-splitting-native-import-context-filter/README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export default foo;
236236

237237
async function getTemplate(templateName) {
238238
try {
239-
let template = await __webpack_require__( 4)(`./${templateName}`);
239+
let template = await __webpack_require__(/*! ./templates */ 4)(`./${templateName}`);
240240
console.log(template);
241241
} catch(err) {
242242
console.error(err);
@@ -255,9 +255,9 @@ getTemplate("baz.noimport");
255255

256256
/***/ }),
257257
/* 4 */
258-
/*!*************************************************************************!*\
259-
!*** ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ***!
260-
\*************************************************************************/
258+
/*!******************************************************************************************!*\
259+
!*** ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ***!
260+
\******************************************************************************************/
261261
/*! no static exports found */
262262
/*! all exports used */
263263
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
@@ -292,11 +292,12 @@ var map = {
292292
function webpackAsyncContext(req) {
293293
var ids = map[req];
294294
if(!ids)
295-
return Promise.reject(new Error("Cannot find module '" + req + "'."));
295+
return Promise.resolve().then(function() { throw new Error("Cannot find module '" + req + "'."); });
296296
return __webpack_require__.e(ids[1]).then(function() {
297-
return __webpack_require__(ids[0]);
297+
var module = __webpack_require__(ids[0]);
298+
return module;
298299
});
299-
};
300+
}
300301
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
301302
return Object.keys(map);
302303
};
@@ -315,31 +316,31 @@ module.exports = webpackAsyncContext;
315316
Hash: c26be64a30f40e562b8c
316317
Version: webpack next
317318
Asset Size Chunks Chunk Names
318-
0.output.js 664 bytes 0 [emitted]
319-
1.output.js 670 bytes 1 [emitted]
320-
2.output.js 661 bytes 2 [emitted]
321-
output.js 8.21 KiB 3 [emitted] main
319+
0.output.js 681 bytes 0 [emitted]
320+
1.output.js 687 bytes 1 [emitted]
321+
2.output.js 678 bytes 2 [emitted]
322+
output.js 8.33 KiB 3 [emitted] main
322323
Entrypoint main = output.js
323324
chunk {0} 0.output.js 41 bytes {3} [rendered]
324325
[2] ./templates/foo.js 41 bytes {0} [optional] [built]
325326
[exports: default]
326-
context element ./foo.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./foo.js
327-
context element ./foo [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./foo
327+
context element ./foo.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
328+
context element ./foo [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
328329
chunk {1} 1.output.js 41 bytes {3} [rendered]
329330
[1] ./templates/baz.js 41 bytes {1} [optional] [built]
330331
[exports: default]
331-
context element ./baz.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./baz.js
332-
context element ./baz [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./baz
332+
context element ./baz.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
333+
context element ./baz [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
333334
chunk {2} 2.output.js 41 bytes {3} [rendered]
334335
[0] ./templates/bar.js 41 bytes {2} [optional] [built]
335336
[exports: default]
336-
context element ./bar.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./bar.js
337-
context element ./bar [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./bar
337+
context element ./bar.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
338+
context element ./bar [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
338339
chunk {3} output.js (main) 618 bytes [entry] [rendered]
339340
> main [3] ./example.js
340341
[3] ./example.js 458 bytes {3} [built]
341342
single entry .\example.js main
342-
[4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ 160 bytes {3} [optional] [built]
343+
[4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built]
343344
import() context lazy ./templates [3] ./example.js 3:23-7:3
344345
```
345346

@@ -353,23 +354,23 @@ Entrypoint main = output.js
353354
chunk {0} 0.output.js 41 bytes {3} [rendered]
354355
[2] ./templates/foo.js 41 bytes {0} [optional] [built]
355356
[exports: default]
356-
context element ./foo.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./foo.js
357-
context element ./foo [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./foo
357+
context element ./foo.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
358+
context element ./foo [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
358359
chunk {1} 1.output.js 41 bytes {3} [rendered]
359360
[1] ./templates/baz.js 41 bytes {1} [optional] [built]
360361
[exports: default]
361-
context element ./baz.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./baz.js
362-
context element ./baz [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./baz
362+
context element ./baz.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
363+
context element ./baz [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
363364
chunk {2} 2.output.js 41 bytes {3} [rendered]
364365
[0] ./templates/bar.js 41 bytes {2} [optional] [built]
365366
[exports: default]
366-
context element ./bar.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./bar.js
367-
context element ./bar [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ ./bar
367+
context element ./bar.js [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
368+
context element ./bar [4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
368369
chunk {3} output.js (main) 618 bytes [entry] [rendered]
369370
> main [3] ./example.js
370371
[3] ./example.js 458 bytes {3} [built]
371372
single entry .\example.js main
372-
[4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ 160 bytes {3} [optional] [built]
373+
[4] ./templates lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object 160 bytes {3} [optional] [built]
373374
import() context lazy ./templates [3] ./example.js 3:23-7:3
374375
375376
ERROR in output.js from UglifyJs

0 commit comments

Comments
 (0)