webpack/examples/extra-async-chunk/template.md

77 lines
1.1 KiB
Markdown
Raw Normal View History

This example shows automatically created async commons chunks.
The example entry references two chunks:
- entry chunk
- async require -> chunk X
- async require -> chunk Y
- chunk X
- module `a`
- module `b`
- module `c`
- chunk Y
- module `a`
- module `b`
- module `d`
These chunks share modules `a` and `b`. The optimization extract these into chunk Z:
2018-02-26 10:39:48 +08:00
Note: Actually the optimization compare size of chunk Z to some minimum value, but this is disabled from this example. In practice there is no configuration needed for this.
- entry chunk
- async require -> chunk X & Z
- async require -> chunk Y & Z
- chunk X
- module `c`
- chunk Y
- module `d`
- chunk Z
- module `a`
- module `b`
2015-01-12 06:17:24 +08:00
Pretty useful for a router in a SPA.
# example.js
```javascript
_{{example.js}}_
```
# dist/output.js
```javascript
_{{dist/output.js}}_
```
# dist/0.output.js
```javascript
_{{dist/0.output.js}}_
```
2018-09-25 23:08:35 +08:00
# dist/2.output.js
```javascript
_{{dist/2.output.js}}_
```
2018-09-25 23:08:35 +08:00
# dist/3.output.js
```javascript
_{{dist/3.output.js}}_
```
# Info
## Unoptimized
```
_{{stdout}}_
```
## Production mode
```
_{{production:stdout}}_
```