-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
website/docs/en/plugins/webpack/limit-chunk-count-plugin.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ApiMeta } from '../../../../components/ApiMeta.tsx'; | ||
import WebpackLicense from '../../../../components/webpack-license'; | ||
|
||
<WebpackLicense from="https://webpack.js.org/plugins/limit-chunk-count-plugin/" /> | ||
|
||
# LimitChunkCountPlugin | ||
|
||
<ApiMeta addedVersion={'0.3.10'} /> | ||
|
||
While writing your code, you may have already added many code split points to load stuff on demand. After compiling you might notice that some chunks are too small - creating larger HTTP overhead. `LimitChunkCountPlugin` can post-process your chunks by merging them. | ||
|
||
```js | ||
new rspack.optimize.LimitChunkCountPlugin({ | ||
// Options... | ||
}); | ||
``` | ||
|
||
## Options | ||
|
||
### maxChunks | ||
|
||
- **Type:** `number` | ||
|
||
Limit the maximum number of chunks using a value greater than or equal to `1`. Using `1` will prevent any additional chunks from being added as the entry/main chunk is also included in the count. | ||
|
||
```js | ||
new rspack.optimize.LimitChunkCountPlugin({ | ||
maxChunks: 5, | ||
}) | ||
``` |
30 changes: 30 additions & 0 deletions
30
website/docs/zh/plugins/webpack/limit-chunk-count-plugin.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ApiMeta } from '../../../../components/ApiMeta.tsx'; | ||
import WebpackLicense from '../../../../components/webpack-license'; | ||
|
||
<WebpackLicense from="https://webpack.js.org/plugins/limit-chunk-count-plugin/" /> | ||
|
||
# LimitChunkCountPlugin | ||
|
||
<ApiMeta addedVersion={'0.3.10'} /> | ||
|
||
在编写代码时,你可能已经添加了许多代码分割点以按需加载内容。在编译后,你可能会注意到有些 chunk 太小——造成了较大的 HTTP 开销。`LimitChunkCountPlugin` 可以在处理完毕后通过合并它们来优化你的 chunk。 | ||
|
||
```js | ||
new rspack.optimize.LimitChunkCountPlugin({ | ||
// 选项... | ||
}); | ||
``` | ||
|
||
## 选项 | ||
|
||
### maxChunks | ||
|
||
- **类型:** `number` | ||
|
||
通过使用大于或等于`1`的值来限制最大代码块数量。使用`1`将阻止添加任何额外的代码块,因为入口/主代码块也包含在计数中。 | ||
|
||
```js | ||
new rspack.optimize.LimitChunkCountPlugin({ | ||
maxChunks: 5, | ||
}) | ||
``` |