kaliber5 / ember-cli-bundlesize

Make sure your Ember app stays small by testing its bundle size against a given size budget.
MIT License
35 stars 5 forks source link

Add a "minimum" size in addition to "limit" #12

Open boris-petrov opened 5 years ago

boris-petrov commented 5 years ago

The reasoning is this - sometimes I could delete a bunch of code or maybe some dependency and my bundle would become much smaller. The bundle-size test would pass easily. Then, later on, I do some stupid mistake which increases my bundle size a lot but I still won't catch it by the bundle-size test because the size is still lower than the initial "limit" that I set.

If we have a "minimum" option then I would lower both it and the "limit" after I remove the dependency initially and then the second time I would catch the mistake I do.

Not sure if I make sense but this is something that I think is possible and would be nice to have.

simonihmig commented 5 years ago

I think relative size checks would be a better solution, see #10. Do you agree?

boris-petrov commented 5 years ago

@simonihmig - I read that issue, yes, however there are 2 advantages of what I suggest in this issue:

1) It should be trivial to implement - just a few lines of code more I guess.

2) The problems that you mention in the other issue are non-trivial to figure out. So I guess until then the "minimum" size I suggest is a simple workaround.

Otherwise yes, maybe the relative checks are better.

jelhan commented 4 years ago

I fear that managing both minimum and limit is hard to maintain and error prune. Maybe we should only set an expected asset size, which the actual asset size must not differ too much from? What is considered too much should be configurable and may default to 1% or something alike. It may provide another option, which controls if the build should fail on too low sizes. Would be the same as here but a more intuitive logic in my opinion.