Webpack 网页包,忽略特定入口点的大小警告限制

Webpack 网页包,忽略特定入口点的大小警告限制,webpack,webpack-4,Webpack,Webpack 4,在我的一个项目的网页包配置中有 目前有两个关于尺寸限制的警告: WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. Entrypoints: entrypoint1 (282 KiB) entrypoint1.js en

在我的一个项目的网页包配置中有

目前有两个关于尺寸限制的警告:

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  entrypoint1 (282 KiB)
      entrypoint1.js
  entrypoint2 (247 KiB)
      entrypoint2.js
我发现这些警告很有用,但在某些情况下,我想隐藏特定入口点的警告,例如,在本例中,
entrypoint2


是否可以忽略/隐藏某些入口点的大小警告,并显示所有其他入口点的大小警告?

我相信您正在寻找Performance assetFilter。

Webpack允许您筛选要获取性能警告的资产:

性能:{
最大资产规模:170000,
资产过滤器:(资产)=>{
return asset.match('entrypoint1.js');
}
}

这将只显示entrypoint1.js的性能警告,当然,您可以在其中构建更复杂的逻辑,以满足环境、更多文件等的各种条件。

谢谢您,Devin!这正是我要找的!