Skip to content

Commit

Permalink
docs(plugins) Remove AggressiveSplittingPlugin and document SplitChun… (
Browse files Browse the repository at this point in the history
#2342)

* docs(plugins) remove AggressiveSplittingPlugin and document SplitChunks maxSize option

* docs(plugins) break long line (lint)
  • Loading branch information
EugeneHlushko authored and montogeek committed Jul 14, 2018
1 parent bf25494 commit 22ba2cd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
37 changes: 0 additions & 37 deletions src/content/plugins/aggressive-splitting-plugin.md

This file was deleted.

1 change: 0 additions & 1 deletion src/content/plugins/index.md
Expand Up @@ -13,7 +13,6 @@ webpack has a rich plugin interface. Most of the features within webpack itself

Name | Description
-------------------------------------------------------- | -----------
[`AggressiveSplittingPlugin`](/plugins/aggressive-splitting-plugin) | Splits the original chunks into smaller chunks
[`BabelMinifyWebpackPlugin`](/plugins/babel-minify-webpack-plugin) | Minification with [babel-minify](https://github.com/babel/minify)
[`BannerPlugin`](/plugins/banner-plugin) | Add a banner to the top of each generated chunk
[`CommonsChunkPlugin`](/plugins/commons-chunk-plugin) | Extract common modules shared between chunks
Expand Down
14 changes: 14 additions & 0 deletions src/content/plugins/split-chunks-plugin.md
Expand Up @@ -52,6 +52,7 @@ module.exports = {
splitChunks: {
chunks: 'async',
minSize: 30000,
maxSize: 0,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
Expand Down Expand Up @@ -140,6 +141,19 @@ Minimum number of chunks that must share a module before splitting.

Minimum size, in bytes, for a chunk to be generated.

### `splitChunks.maxSize`

`number`

Using `maxSize` (either globally `optimization.splitChunks.maxSize` per cache group `optimization.splitChunks.cacheGroups[x].maxSize` or for the fallback cache group `optimization.splitChunks.fallbackCacheGroup.maxSize`) tells webpack to try to split chunks bigger than `maxSize` into smaller parts. Parts will be at least `minSize` (next to `maxSize`) in size.
The algorithm is deterministic and changes to the modules will only have local impact. So that it is usable when using long term caching and doesn't require records. `maxSize` is only a hint and could be violated when modules are bigger than `maxSize` or splitting would violate `minSize`.

When the chunk has a name already, each part will get a new name derived from that name. Depending on the value of `optimization.splitChunks.hidePathInfo` it will add a key derived from the first module name or a hash of it.

`maxSize` options is intended to be used with HTTP/2 and long term caching. It increase the request count for better caching. It could also be used to decrease the file size for faster rebuilding.

T> `maxSize` takes higher priority than `maxInitialRequest/maxAsyncRequests`. Actual priority is `maxInitialRequest/maxAsyncRequests < maxSize < minSize`.

### `splitChunks.name`

`boolean: true` `function` `string`
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Expand Up @@ -128,7 +128,8 @@ module.exports = (env) => ({
'guides/why-webpack': '/comparison/',
'guides/production-build': '/guides/production/',
'migrating': '/migrate/3/',
'plugins/no-emit-on-errors-plugin': '/configuration/optimization/#optimization-noemitonerrors'
'plugins/no-emit-on-errors-plugin': '/configuration/optimization/#optimization-noemitonerrors',
'/plugins/aggressive-splitting-plugin': `/plugins/split-chunks-plugin/`
},
}),
]
Expand Down

0 comments on commit 22ba2cd

Please sign in to comment.