rollup-plugin-visualizer
rollup-plugin-visualizer copied to clipboard
Assert size increase
Something to think about. I already have list template that can be used to track sizes and commited to repo. I can add some property that will not allow to override this file in case size increased for example to some percent.
👋 Hi, I just came across this library and found it perfect for diagnosing what's going on – well done!
Actually, I started something a few months back, https://github.com/jycouet/vite-plugin-lib-reporter, to track increases over builds. I use it in my projects to keep track of things, and it's working well. I would be happy to kill my repository if we/i add something similar here 👍
Do you have a specific API in mind?
Hi, sorry i missed you message. Somehow i messed github notification settings.
I do not have any specific API in mind. What i am trying to follow in this plugin:
- Reasonable opinionated way
- Minimum settings, ideally 0
Currently plugin allows to add different types of reporters/templates. So most likely we can add one more that will read previous data and compare to provided settings. So i see to new options added - diffLevel to assert, and where to store state. Technically this can be attached to list reporter as it is literally previous state and we only need diffLevel
I would like also to configure as less as possible.
diffLevel, I guess that you have in mind a % (So a number? Maybe defaulting to 0?) The first time, since there is no previous data, you would allow the thing? And later, you would accept x increase? (Failing the build?)
I'm not sure how/where to store the previous build? (or the target branch build?)
Yes sounds right what you wrote. I created this issue when i added list template (which is just yml content with bundle/file/size entries). Basically this is actual state of bundles reported by rollup/plugin.
- On initial build there is no state, pass always.
- When file on the same path found, it is possible to start asserting if it is enabled
- If assertion enabled we take size of previous builld, new build get diff in % or kb (this need to think) and assert when threshold exceeds
There are moments that i think of:
- Assertion should be opt-in, backward compatible - not enabled, not reported
- Not sure if we need fail build or warn or any other action. I understand purpose of failing build, warnings are useless
- Size difference, % makes sense, does kb difference makes sense?
- I was thinking to use specifically list template because it contains what exactly changed - so that we can report this back, like file1, file2 added, file3 increased in size etc.