React Native Bundle Discovery

Bundle size checks in CI

compare exits with code 1 when any check fails:

OptionFails whenExample
--fail-on-increaseThe bundle grows more than the limit (bytes or % of "before")50KB, 0.5MB, 51200, 5%
--max-sizeThe "after" bundle is bigger than the limit3MB
--fail-onNew duplicate and/or deprecated packages appearnew-duplicates,new-deprecated
npx react-native-bundle-discovery-cli compare --before main-stats.json --after pr-stats.json \
  --fail-on-increase 50KB \
  --max-size 3MB \
  --fail-on new-duplicates,new-deprecated

GitHub Actions

Works out of the box: the markdown report is added to the job summary and failed checks are shown as error annotations.

- run: npx react-native-bundle-discovery-cli compare --before main-stats.json --after pr-stats.json --fail-on-increase 5%

To post the report as a PR comment, use --format markdown.

On this page