Skip to content

Commit

Permalink
Merge pull request #9006 from hiroppy/feature/fix-template-syntax
Browse files Browse the repository at this point in the history
fix examples template syntax
  • Loading branch information
sokra committed Apr 8, 2019
2 parents 9e60850 + 4796959 commit 5117461
Show file tree
Hide file tree
Showing 87 changed files with 955 additions and 987 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
20 changes: 10 additions & 10 deletions examples/aggressive-merging/template.md
@@ -1,19 +1,19 @@
# pageA.js

``` javascript
{{pageA.js}}
```javascript
_{{pageA.js}}_
```

# pageB.js

``` javascript
{{pageB.js}}
```javascript
_{{pageB.js}}_
```

# pageC.js

``` javascript
{{pageC.js}}
```javascript
_{{pageC.js}}_
```

# common.js
Expand All @@ -22,20 +22,20 @@ a big file...

# webpack.config.js

``` javascript
{{webpack.config.js}}
```javascript
_{{webpack.config.js}}_
```

# Info

## Unoptimized

```
{{stdout}}
_{{stdout}}_
```

## Production mode

```
{{production:stdout}}
_{{production:stdout}}_
```
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
47 changes: 22 additions & 25 deletions examples/chunkhash/template.md
Expand Up @@ -4,62 +4,59 @@ 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
{{example.js}}
```javascript
_{{example.js}}_
```

# webpack.config.js

``` javascript
{{webpack.config.js}}
```javascript
_{{webpack.config.js}}_
```

# index.html

``` html
```html
<html>
<head>
</head>
<body>

<!-- inlined minimized file "runtime~main.[chunkhash].js" -->
<script>
{{production:dist/runtime~main.chunkhash.js}}
</script>

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

</body>
<head> </head>
<body>
<!-- inlined minimized file "runtime~main.[chunkhash].js" -->
<script>
_{{production:dist/runtime~main.chunkhash.js}}_
</script>

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

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

``` javascript
{{dist/runtime~main.chunkhash.js}}
```javascript
_{{dist/runtime~main.chunkhash.js}}_
```

# dist/main.[chunkhash].js

``` javascript
{{dist/main.chunkhash.js}}
```javascript
_{{dist/main.chunkhash.js}}_
```

# Info

## Unoptimized

```
{{stdout}}
_{{stdout}}_
```

## Production mode

```
{{production:stdout}}
_{{production:stdout}}_
```
10 changes: 5 additions & 5 deletions examples/code-splitted-require.context-amd/template.md
@@ -1,31 +1,31 @@
# example.js

``` javascript
{{example.js}}
_{{example.js}}_
```

# dist/output.js

``` javascript
{{dist/output.js}}
_{{dist/output.js}}_
```

# dist/1.output.js

``` javascript
{{dist/1.output.js}}
_{{dist/1.output.js}}_
```

# Info

## Unoptimized

```
{{stdout}}
_{{stdout}}_
```

## Production mode

```
{{production:stdout}}
_{{production:stdout}}_
```
10 changes: 5 additions & 5 deletions examples/code-splitted-require.context/template.md
@@ -1,31 +1,31 @@
# example.js

``` javascript
{{example.js}}
_{{example.js}}_
```

# dist/output.js

``` javascript
{{dist/output.js}}
_{{dist/output.js}}_
```

# dist/1.output.js

``` javascript
{{dist/1.output.js}}
_{{dist/1.output.js}}_
```

# Info

## Unoptimized

```
{{stdout}}
_{{stdout}}_
```

## Production mode

```
{{production:stdout}}
_{{production:stdout}}_
```
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

0 comments on commit 5117461

Please sign in to comment.