admin管理员组文章数量:1332377
I'm finding the option descriptions for Webpack's LimitChunkCountPlugin
, MinChunkSizePlugin
, and AggressiveMergingPlugin
to be a bit confusing. Some are self-explanatory but others are very vague.
In LimitChunkCountPlugin I'm presented with 3 options:
options.maxChunks
(number) max number of chunks
options.chunkOverhead
(number) an additional overhead for each chunk in bytes (default 10000, to reflect request delay)
options.entryChunkMultiplicator
(number) a multiplicator for entry chunks (default 10, entry chunks are merged 10 times less likely)
- So
maxChunks
is pretty self-explanatory - I have no idea what
chunkOverhead
is as it sounds like it adds 10,000 empty bytes to the chunk to reflect adelay
??? Which makes no sense entryChunkMultiplicator
is not as vague but still pretty vague. I'm guessing is some abstract number where the higher it is the less likely the entry chunk (Theres only 1 entry chunk in my case) will be merged into another chunk
In MinChunkSizePlugin I'm presented with one option
Merge small chunks that are lower than this min size (in chars). Size is approximated.
options.minChunkSize
(number) chunks smaller than this number will be merged
So how big is a char, an ascii char is 1-byte but a utf-8 and utf-16 can be up to 2 or more bytes (If I'm correct). I'm guessing we're going with 1-char to 1-byte in which case 1024 for example would be 1kb. Also What values do other people use?
For the AggressiveMergingPlugin
options.minSizeReduce
A factor which defines the minimal required size reduction for chunk merging. Defaults to 1.5 which means that the total size need to be reduce by 50% for chunk merging.
options.moveToParents
When set, modules that are not in both merged chunks are moved to all parents of the chunk. Defaults tofalse
.
options.entryChunkMultiplicator
When options.moveToParents is set, moving to an entry chunk is more expensive. Defaults to 10, which means moving to an entry chunk is ten times more expensive than moving to an normal chunk.
minSizeReduce
is pretty simple, if the chunk can be shrunk down by 50% or more merge itmoveToParents
this is also pretty confusing, its set to false by default which throws up red flags that maybe I shouldn't touch it, but it sounds like it duplicates and moves all un-shared modules to all parents. If so why would anyone use that option.entryChunkMultiplicator
this is pretty abstract and vague, it sounds like, when modules are moved to an entry chunk it becmes 10 times slower to access which can't be right. Why would I want to make it slower?
If anyone can clear this up for me thanks very much in advance.
I'm finding the option descriptions for Webpack's LimitChunkCountPlugin
, MinChunkSizePlugin
, and AggressiveMergingPlugin
to be a bit confusing. Some are self-explanatory but others are very vague.
In LimitChunkCountPlugin I'm presented with 3 options:
options.maxChunks
(number) max number of chunks
options.chunkOverhead
(number) an additional overhead for each chunk in bytes (default 10000, to reflect request delay)
options.entryChunkMultiplicator
(number) a multiplicator for entry chunks (default 10, entry chunks are merged 10 times less likely)
- So
maxChunks
is pretty self-explanatory - I have no idea what
chunkOverhead
is as it sounds like it adds 10,000 empty bytes to the chunk to reflect adelay
??? Which makes no sense entryChunkMultiplicator
is not as vague but still pretty vague. I'm guessing is some abstract number where the higher it is the less likely the entry chunk (Theres only 1 entry chunk in my case) will be merged into another chunk
In MinChunkSizePlugin I'm presented with one option
Merge small chunks that are lower than this min size (in chars). Size is approximated.
options.minChunkSize
(number) chunks smaller than this number will be merged
So how big is a char, an ascii char is 1-byte but a utf-8 and utf-16 can be up to 2 or more bytes (If I'm correct). I'm guessing we're going with 1-char to 1-byte in which case 1024 for example would be 1kb. Also What values do other people use?
For the AggressiveMergingPlugin
options.minSizeReduce
A factor which defines the minimal required size reduction for chunk merging. Defaults to 1.5 which means that the total size need to be reduce by 50% for chunk merging.
options.moveToParents
When set, modules that are not in both merged chunks are moved to all parents of the chunk. Defaults tofalse
.
options.entryChunkMultiplicator
When options.moveToParents is set, moving to an entry chunk is more expensive. Defaults to 10, which means moving to an entry chunk is ten times more expensive than moving to an normal chunk.
minSizeReduce
is pretty simple, if the chunk can be shrunk down by 50% or more merge itmoveToParents
this is also pretty confusing, its set to false by default which throws up red flags that maybe I shouldn't touch it, but it sounds like it duplicates and moves all un-shared modules to all parents. If so why would anyone use that option.entryChunkMultiplicator
this is pretty abstract and vague, it sounds like, when modules are moved to an entry chunk it becmes 10 times slower to access which can't be right. Why would I want to make it slower?
If anyone can clear this up for me thanks very much in advance.
Share Improve this question edited Sep 12, 2018 at 11:30 n1stre 6,0964 gold badges23 silver badges42 bronze badges asked May 5, 2016 at 4:09 黒い雪黒い雪 56310 silver badges18 bronze badges 2-
Looking at the source, I don't see the
chunkOverhead
option for theLimitChunkCountPlugin
. What version do you use ? – adz5A Commented Sep 18, 2018 at 11:21 - @adz5A webpack.js/plugins/limit-chunk-count-plugin – Piterden Commented Oct 8, 2018 at 1:00
1 Answer
Reset to default 1LimitChunkCountPlugin
While writing your code, you may have already added many code split points to load stuff on demand. After piling you might notice that some chunks are too small - creating larger HTTP overhead. Luckily, this plugin can post-process your chunks by merging them.
MinChunkSizePlugin
Keep chunk size above the specified limit by merging chunks that are smaller than the minChunkSize
.
AggressiveMergingPlugin
Is actually absent in latest API which you probably use. Maybe this?
本文标签:
版权声明:本文标题:javascript - Please explain Webpack LimitChunkCountPlugin, MinChunkSizePlugin, and AggressiveMergingPlugin - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742306095a2449947.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论