For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/plugins/limit-chunk-count-plugin.md.
close

LimitChunkCountPlugin

在编写代码时,你可能已经添加了许多代码分割点以按需加载内容。在编译后,你可能会注意到有些 chunk 太小——造成了较大的 HTTP 开销。LimitChunkCountPlugin 可以在处理完毕后通过合并它们来优化你的 chunk。

new rspack.optimize.LimitChunkCountPlugin({
  // 选项...
});

选项

maxChunks

  • 类型: number

通过使用大于或等于1的值来限制最大代码块数量。使用1将阻止添加任何额外的代码块,因为入口/主代码 chunk 也包含在计数中。

new rspack.optimize.LimitChunkCountPlugin({
  maxChunks: 5,
});

本页改编自 webpack 文档,遵循 CC BY 4.0,且已作修改。