danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.82k stars 100 forks source link

Analyse bundle size in CI (show in PR) #149

Open Kamahl19 opened 4 years ago

Kamahl19 commented 4 years ago

Has anyone setup this to run as a GH action to show the bundle size in PR? I imagine a GH Action to build the app, run the analyse and post a comment with link to analyse into PR. It could even print a diff in size against Master branch. We could even have a badge in README pointing to current analyse of master.

bxt commented 4 years ago

We have set this up, but independent of source-map-explorer. After our app is build we use a script using node's fs.stat function to measure the total bundle size. We also get the bundle size from master form a build docker image for comparison. We then use the GitHub statuses API to attach the result to the PR. We also run source-map-explorer and link to it's report from the PR, so if the numbers increased you can check manually where the problem is. It is a bit of work to write a script that does all that, but I think it's not in scope of source-map-explorer, it's also very much dependent on wether you use GitLab/GitHub/Jenkins/Travis/...

What could be in scope of source-map-explorer maybe (I guess the maintainers have to decide that) is a comparison view, where you can compare two sets of bundle files, that would be pretty cool.