bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

Add Diff budgeting in addition to maxSize budget

Open kanalveli-ramachandran opened this issue 3 years ago • 2 comments

Do you want to request a feature or report a bug? Feature

If this is a feature request, what is motivation or use case for changing the behavior?

While we can currently setup maxSize budgets for file patterns, periodic incremental changes will end up breaching the budget. So can we also consider implementing diff budgets?

Please mention other relevant information.

  • node version
  • npm version
  • Operating system
  • bundlesize version - 0.17.1
  • CI you are using - Jenkins

kanalveli-ramachandran avatar Aug 26 '20 08:08 kanalveli-ramachandran

So can we also consider implementing diff budgets?

Can you tell me a little more about diff budgets? What would that look like?

siddharthkp avatar Jul 21 '21 16:07 siddharthkp

So can we also consider implementing diff budgets?

Can you tell me a little more about diff budgets? What would that look like?

Currently we have maxSize budgets,

{
  "path": "./dist/assets/feature-module*.js",
  "compression": "brotli",
  "maxSize": "30 kB"
}

In any product, each module will incrementally be worked upon. So over a period of pull request merges, the maxSize budget will be breached.

So if we can also setup a budget on the increase in size that can be allowed per request,

 {
  "path": "./dist/assets/feature-module*.js",
  "compression": "brotli",
  "diffSize": "100 B"
}

We would be able to control things at a granular level.

This will also help capture bulk increases in the asset. ie, a maxSize of 30kb will not be able to capture a dependency change that brings in a 5kb increase in size on a 23kb asset. but a 1kb diffSize will easily capture these anomalies.

kanalveli-ramachandran avatar Jul 22 '21 08:07 kanalveli-ramachandran