GitHub action that analyses the bundle sizes for each route in a Next.js build.
Add the following step to a workflow which runs on a pull_request event, after the Next.js project has been built (i.e. after running yarn build
).
- name: Analyze bundle sizes
uses: transferwise/actions-next-bundle-analyzer@master
with:
# Filename of the workflow this step is defined in
workflow-id: my-workflow.yml
# Optional, defaults to master
base-branch: master
# Optional, specifies where to look for .next folder. Default to cwd.
working-directory: /packages/my-package
env:
# This secret is automatically injected by GitHub
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
When the job runs on a pull request a comment will be added showing the bundle sizes of the branch and the difference against master:
Note: Difference to master will only be shown once this action has run on a master commit.
When the workflow runs on the base branch, it will create/update a GitHub Issue with the current bundle sizes.
Compiled files must also be commited. After making changes to TypeScript files run
yarn build
Add both the source files and the new compiled files to your pull request.