You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An easy way to plug
size-limit
into your nx powered projects.
Size Limit is a performance budget tool for JavaScript. It checks every commit on CI, calculates the real cost of your JS for end-users and throws an error if the cost exceeds the limit.
It will produce a nice report helps to analyze the bundle
as specified on this section.
You will need to install @size-limit/esbuild-why or @size-limit/webpack-why depends on which bundler you are using (default is esbuild).
Run a limit check
nx run your-project:size-limit
CI
This is an initial suggestion, iterate over the distributed projects and run size-limit.
- name: Get list of affected appsrun: | APPS=( $(ls -1d dist/apps/*/ | xargs -n 1 basename) ) echo "APPS=$APPS" >> $GITHUB_ENV
- name: Run NX command per appenv:
APPS: ${{ env.APPS }}run: | for app in $APPS; do npx nx run $app:size-limit done
Credits
This plugin wouldn't be possible without the great teams behind these projects:
size-limit - Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.