Skip to content

Commit

Permalink
chore(examples): regenerate README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Apr 8, 2019
1 parent 83b0013 commit 4796959
Show file tree
Hide file tree
Showing 41 changed files with 345 additions and 361 deletions.
8 changes: 4 additions & 4 deletions examples/aggressive-merging/README.md
@@ -1,22 +1,22 @@
# pageA.js

``` javascript
```javascript
require(["./common"], function(common) {
common(require("./a"));
});
```

# pageB.js

``` javascript
```javascript
require(["./common"], function(common) {
common(require("./b"));
});
```

# pageC.js

``` javascript
```javascript
require(["./a"], function(a) {
console.log(a + require("./b"));
});
Expand All @@ -28,7 +28,7 @@ a big file...

# webpack.config.js

``` javascript
```javascript
var path = require("path");
var AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin");
module.exports = {
Expand Down
35 changes: 16 additions & 19 deletions examples/chunkhash/README.md
Expand Up @@ -4,20 +4,20 @@ A very simple solution to this problem is to create another chunk which contains

The configuration required for this is:

* use `[chunkhash]` in `output.filename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)
* use `[chunkhash]` in `output.chunkFilename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)
- use `[chunkhash]` in `output.filename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)
- use `[chunkhash]` in `output.chunkFilename` (Note that this example doesn't do this because of the example generator infrastructure, but you should)

# example.js

``` javascript
```javascript
// some module
import("./async1");
import("./async2");
```

# webpack.config.js

``` javascript
```javascript
var path = require("path");
module.exports = {
// mode: "development || "production",
Expand All @@ -37,28 +37,25 @@ module.exports = {

# index.html

``` html
```html
<html>
<head>
</head>
<body>
<head> </head>
<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()}([]);
</script>

<!-- 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()}([]);
</script>

<script src="dist/main.[chunkhash].js"></script>

</body>
<script src="dist/main.[chunkhash].js"></script>
</body>
</html>
```

# dist/runtime~main.[chunkhash].js

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -281,13 +278,13 @@ module.exports = {

</details>

``` javascript
```javascript
/******/ ([]);
```

# dist/main.[chunkhash].js

``` javascript
```javascript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],[
/* 0 */
/*!********************!*\
Expand Down
11 changes: 5 additions & 6 deletions examples/code-splitting-bundle-loader/README.md
Expand Up @@ -4,24 +4,23 @@ The bundle loader is used to create a wrapper module for `file.js` that loads th

# example.js

``` javascript
```javascript
require("bundle-loader!./file.js")(function(fileJsExports) {
console.log(fileJsExports);
});
```

# file.js

``` javascript
```javascript
module.exports = "It works";
```


# dist/output.js

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -224,7 +223,7 @@ module.exports = "It works";

</details>

``` javascript
```javascript
/******/ ([
/* 0 */
/*!********************!*\
Expand Down Expand Up @@ -267,7 +266,7 @@ __webpack_require__.e(/*! require.ensure */ 1).then((function(require) {

# dist/1.output.js

``` javascript
```javascript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],{

/***/ 2:
Expand Down
8 changes: 3 additions & 5 deletions examples/code-splitting-harmony/README.md
Expand Up @@ -8,7 +8,7 @@ Providing dynamic expressions to `import` is possible. The same limits as with d

# example.js

``` javascript
```javascript
import a from "a";

import("b").then(function(b) {
Expand All @@ -24,12 +24,11 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
});
```


# dist/output.js

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -232,7 +231,7 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {

</details>

``` javascript
```javascript
/******/ ([
/* 0 */,
/* 1 */,
Expand Down Expand Up @@ -322,7 +321,6 @@ module.exports = webpackAsyncContext;
/******/ ]);
```


# Info

## Unoptimized
Expand Down
22 changes: 11 additions & 11 deletions examples/code-splitting-native-import-context-filter/README.md
@@ -1,9 +1,9 @@
# example.js

This example illustrates how to filter the ContextModule results of `import()` statements. only `.js` files that don't
This example illustrates how to filter the ContextModule results of `import()` statements. only `.js` files that don't
end in `.noimport.js` within the `templates` folder will be bundled.

``` javascript
```javascript
async function getTemplate(templateName) {
try {
let template = await import(
Expand All @@ -28,16 +28,16 @@ getTemplate("baz.noimport");

# templates/

* foo.js
* foo.noimport.js
* baz.js
* foo.noimport.js
* bar.js
* foo.noimport.js
- foo.js
- foo.noimport.js
- baz.js
- foo.noimport.js
- bar.js
- foo.noimport.js

All templates are of this pattern:

``` javascript
```javascript
var foo = "foo";

export default foo;
Expand All @@ -47,7 +47,7 @@ export default foo;

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -250,7 +250,7 @@ export default foo;

</details>

``` javascript
```javascript
/******/ ([
/* 0 */,
/* 1 */,
Expand Down
14 changes: 7 additions & 7 deletions examples/code-splitting-native-import-context/README.md
Expand Up @@ -2,7 +2,7 @@

This example illustrates how to leverage the `import()` syntax to create ContextModules which are separated into separate chunks for each module in the `./templates` folder.

``` javascript
```javascript
async function getTemplate(templateName) {
try {
let template = await import(`./templates/${templateName}`);
Expand All @@ -20,13 +20,13 @@ getTemplate("baz");

# templates/

* foo.js
* baz.js
* bar.js
- foo.js
- baz.js
- bar.js

All templates are of this pattern:

``` javascript
```javascript
var foo = "foo";

export default foo;
Expand All @@ -36,7 +36,7 @@ export default foo;

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -239,7 +239,7 @@ export default foo;

</details>

``` javascript
```javascript
/******/ ([
/* 0 */,
/* 1 */,
Expand Down
14 changes: 7 additions & 7 deletions examples/code-splitting-specify-chunk-name/README.md
Expand Up @@ -2,7 +2,7 @@

This example illustrates how to specify chunk name in `require.ensure()` and `import()` to separated modules into separate chunks manually.

``` javascript
```javascript
import("./templates/foo" /* webpackChunkName: "chunk-foo" */ ).then(function(foo) {
console.log('foo:', foo);
})
Expand All @@ -20,13 +20,13 @@ import("./templates/ba" + createContextVar /* webpackChunkName: "chunk-bar-baz"

# templates/

* foo.js
* baz.js
* bar.js
- foo.js
- baz.js
- bar.js

All templates are of this pattern:

``` javascript
```javascript
var foo = "foo";

export default foo;
Expand All @@ -36,7 +36,7 @@ export default foo;

<details><summary><code>/******/ (function(modules) { /* webpackBootstrap */ })</code></summary>

``` javascript
```javascript
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ function webpackJsonpCallback(data) {
Expand Down Expand Up @@ -239,7 +239,7 @@ export default foo;

</details>

``` javascript
```javascript
/******/ ([
/* 0 */,
/* 1 */,
Expand Down

0 comments on commit 4796959

Please sign in to comment.