Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
package

GitHub Action

esbuild-bundle-analyzer

v1.1.0

esbuild-bundle-analyzer

package

esbuild-bundle-analyzer

Analyzes each PR's impact on esbuild bundle size

Installation

Copy and paste the following snippet into your .yml file.

              

- name: esbuild-bundle-analyzer

uses: exoego/esbuild-bundle-analyzer@v1.1.0

Learn more about this action in exoego/esbuild-bundle-analyzer

Choose a version

esbuild-bundle-analyzer GitHub Action

test

Analyzes each PR's impact on esbuild bundle size

comment-example

Usage

Basic

# Ensure you build your project before running this action
- name: Run esbuild
  run: npm run build

# Call this action after the build
- name: Analyze esbuild bundle size
  # uses: exoego/esbuild-bundle-analyzer@main # If you prefer nightly!
  uses: exoego/esbuild-bundle-analyzer@v1
  with:
    metafiles: "out/meta.json"

As of esbuild v0.20.0, you need to write meta file yourself after build, something like this:

// esbuild.mjs
import * as esbuild from 'esbuild'
import fs from 'node:fs'

let result = await esbuild.build({
    entryPoints: ['src/app1.ts', 'src/app2.ts'],
    bundle: true,
    metafile: true,
    outdir: 'dist',
})

fs.writeFileSync('dist/meta.json', JSON.stringify(result.metafile))

In this case, the metafiles input should be "dist/meta.json".

If you have multiple meta files, you can specify them like this "dist/meta1.json,dist/meta2.json".

Action inputs

Name Default Description
metafiles - A required comma-separated list of paths to esbuild's meta file.
name ${{ github.event.
repository.name }}
The name of your project. This will be used in the comment header.
analyze_directory .analyzer A path to working directory where bundle analysis are stored.
include_extensions .js,.cjs,.mjs A comma-separated list of file extension to be included in the analysis table.
percent_extra_attention 20 If an out file size has increased more than this percent, display a "‼️" to draw extra attention to the change.
show_details true If true, a collapsed "details" section is rendered. It explains the details of the numbers provided and icons.

Action outputs

No outputs are provided by this action at this time.

Acknowledgements

License

MIT