source-map-explorer icon indicating copy to clipboard operation
source-map-explorer copied to clipboard

Analyse bundle size in CI (show in PR)

Open Kamahl19 opened this issue 5 years ago • 1 comments

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.

Kamahl19 avatar Dec 01 '19 00:12 Kamahl19

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.

bxt avatar Apr 29 '20 11:04 bxt