Skip to content

Github Action that analyses page bundle sizes from a Next.js build

Notifications You must be signed in to change notification settings

CruGlobal/actions-next-bundle-analyzer

 
 

Repository files navigation

actions-next-bundle-analyzer

GitHub action that analyses the bundle sizes for each route in a Next.js build.

Usage

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 }}

On a Pull Request

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:

image

Note: Difference to master will only be shown once this action has run on a master commit.

On the base branch

When the workflow runs on the base branch, it will create/update a GitHub Issue with the current bundle sizes.

image

Contributing

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.

About

Github Action that analyses page bundle sizes from a Next.js build

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.4%
  • JavaScript 0.6%