size-limit
size-limit copied to clipboard
Output --why webpack build for CI purposes
Hello,
As a user of CircleCI (or any other CI system), I would like to be able to store the output of the --why functionality in my build artifacts. This would allow me to use size limit to visually see what changed between builds, something that becomes rather complex over a large amount of commits.
If this is something that is possible I'd love to contribute.
Cheers, Jeffrey
Do I understand correctly that you want --why with custom webpack config?
In this case, just add Webpack Bundle Analyzer to your custom config.
Maybe we can do it automatically? Like changing webpack config in Size Limit. Do you want to send PR? (I am preparing for the conference and will be able to do it only in next week).
I guess i'm trying to understand where the build is being stored. If I could customize it using CLI I could then store it using CircleCI to define temp folders which are copied into my artifacts.
See documentation here. https://circleci.com/docs/2.0/artifacts/
I can try to get a PR up this weekend if this is something that would be useful for other consumers as well. 😄
@jeffredodd Size Limit builds a project in memory. So you will not find it on the disk. Why do you need to find it?
@ai The purpose of this is to store the information on a per build basis. I work in a repository that receives a lot of internal contributions daily and we store our test coverage data in artifacts so we have a historical reference to the values at build time. This helps us during investigations say on why test coverage decreased, when, why it happened, etc.
We are hoping to do the same thing with SizeLimit, and by storing the output of --why would allow us to browse this information historical using the same tools versus pulling down a specific commit number and running it locally.
@jeffredodd Got it. Do you want to store total bundle size or you want to store the whole --why tree?
Usually we store the whole webpack bundle or --why tree. I'll try to take a stab at it this weekend! Your feedback will be appreciated 😄.
There are 2 options:
- You use custom webpack config, add Webpack Bundle Analyzer there with custom callback with
statsdata. - You can add
--why-stats path/to/file/to/save/statsoption to Size Limit
Do you have custom webpack config right now?
@jeffredodd Sorry to bother you here but I didn't find any other way to contact you: What's your experience so far with using build artifacts for historical data?
The circle CI documentation says that there is no guarantee about storage duration and that artifacts should only be used around build time. I would like to use build artifacts for historical analysis of our builds but the statements on the documentation lead me to believe that they're not appropriate for those things.
There is a 3GB curl file size limit. Artifacts are designed to be useful around the time of the build. It is best practice not to rely on artifacts as a software distribution mechanism with long term future guarantees. -- https://circleci.com/docs/2.0/artifacts/#artifacts-overview
@ai
You can add --why-stats path/to/file/to/save/stats option to Size Limit
I wanted to confirm, does that option exist today or are you suggesting this would be a good capability for someone to add via PR?
@mflores-verys sorry for the long delay. Had hard times because of the conference.
I wanted to confirm, does that option exist today or are you suggesting this would be a good capability for someone to add via PR?
Size Limit doesn’t have this option.
If you want to send PR, I will help you and accept it.