浮声新志

webpack插件篇:OccurrenceOrderPlugin详解

用途说明

OccurrenceOrderPlugin (根据模块调用次数,给模块分配ids,常被调用的ids分配更短的id,使得ids可预测,降低文件大小,该模块推荐使用)

Assign the module and chunk ids by occurrence count. Ids that are used often get lower (shorter) ids. This make ids predictable, reduces total file size and is recommended.

  • preferEntry (boolean) give entry chunks higher priority. This make entry chunks smaller but increases the overall size. (recommended)

webpack.config.js配置

1
new webpack.optimize.OccurrenceOrderPlugin(preferEntry)

案例

1
2