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
Bundle size tracking for your build artifacts
Track, compare, and prevent bundle size regressions to maintain web performance (e.g. LCP) across product areas.
As a developer, I want to track bundle size regressions per product area and route,
so that we can avoid performance regressions and optimize LCP over time.
The plugin should:
Analyze stats.json output from different bundler.
Identify and compare main, initial, and lazy chunks over glob matching
Use chunk input fingerprinting to map renamed chunk files.
Group chunk sizes by route/product (e.g., /route-1, /route-2).
give penalties for site and blacklisted imports
visualise inputs as well as static imports as they directly contribute to the real bundle size.
Store and compare bundle stats across versions/releases.
Metric
Bundle size in bytes.
Parsed from --stats-json output and grouped by file.
Property
Value
Description
value
132341
Total size of all chunks.
displayValue
13.4 MB / 13 Files
Display value inc. number of files.
Integration Requirements
The plugin can be implemented in 2 ways:
Using stats files
Crawling the filesystem
As stats file serve significantly more details and are state of the art when debugging bundle size this issue favours this approach.
Using Stats Files
Bundle stats are detailed metadata about your build outputsβlisting each generated file, its original inputs, and any static importsβexported via a metafile (e.g. from ESBuild or other bundlers).
The resulting file maintains the following data structure:
EsbuildBundleStats # Root object containing all bundle stats
βββ inputs (Record<string, MetafileInput>) # Map of each source input file to its metadata
β βββ <inputPath> # File path of a specific input module
β βββ bytes: number # Size of this input module in bytes
β βββ imports (MetafileImport[]) # List of static imports declared by this input
β βββ [ ] # Array of import entries
β βββ path: string # Resolved filesystem path of the imported module
β βββ kind: ImportKind # Import type (e.g. "import", "require", "dynamic")
β βββ external?: boolean # True if marked external (excluded from bundle)
β βββ original?: string # Original import specifier in source code
βββ outputs (Record<string, MetafileOutput>)# Map of each generated output file to its metadata
βββ <outputPath> # File path of a specific output chunk
βββ bytes: number # Total size of this output file in bytes
βββ inputs (Record<string,MetafileOutputInput>) # Map of input modules contributing to this output
β βββ <inputPath> # Path of an input that fed into this output
β βββ bytesInOutput: number # Number of bytes this input contributed to the output
βββ imports (MetafileImport[]) # List of static imports found in this output
β βββ [ ] # Array of import entries
β βββ path: string # Resolved filesystem path of the imported module
β βββ kind: ImportKind # Import type (e.g. "import", "require", "dynamic")
β βββ external?: boolean # True if marked external (excluded from bundle)
β βββ original?: string # Original import specifier in source code
βββ exports: string[] # List of named exports provided by this bundle
βββ entryPoint?: string # Entry-point module path for this output chunk, if any
File Type Definitions
Type
Structure
Description
inputs
Record<string, MetafileInput>
Map of each source file path to its metadata (bytes and imports).
imports
MetafileImport[]
Array of import entries, each with path, kind, and optional flags.
π outputs
Record<string, MetafileOutput>
Map of each output file path to its metadata (bytes, inputs, imports, exports, entryPoint).
π entryPoint
string (optional)
The entry-point module path for this output chunk, if present.
The plugin will use this information to gather the configured artefact groups.
Crawling the filesystem
Note
No research done as not scaleable
Setup and Requirements
π¦ Package Dependencies
Dev Dependencies:
None required, optional CLI runner for local debugging.
To select files for an audit, glob patterns are used to include and exclude parts of the output files.
All options are provided as glob patterns matching either path, path in inputs or entryPoint.
Types
exportinterfaceSelectionOptions{mode: 'bundle'|'onlyMatching'|'withAllDeps'|'withStartupDeps'// targeting output path of a `OutputNode`includeOutputs: string[];excludeOutputs: string[];// targeting input paths of a `OutputNode`includeInputs: string[];excludeInputs: string[];}
xychart-beta
title "Score vs Artifact Size (with penalty shift)"
x-axis [0, 1, 1.25, 1.5, 1.75, 2]
y-axis "Score" 0 --> 1
line Original [1, 1, 0.75, 0.5, 0.25, 0]
line Penalized [0.5, 0.5, 0.25, 0, 0, 0]
Loading
Issues
To give users actionable feedback we need to be able to tell WHAT happened, WHERE it is, and HOW to fix it.
Issues are configured per audit under the scoring.penalty property.
The plugin creates diagnostics for each penalty. The table below shows all diagnostic types:
Diagnostic
Description
Config Key
Default
Severity
Recommended Action
Blacklisted
Artifact contains an import matching a forbidden glob pattern.
blacklist
β
π¨ Error
Remove or replace the forbidden dependency.
Too Large
Artifact exceeds the maximum allowed size. May indicate an unoptimized bundle or accidental check-in.
maxArtifactSize
5 MB
π¨ Error
Review and optimize (e.g. code splitting, compression).
Too Small
Artifact is below the minimum expected size. Could signal missing dependencies or incomplete build.
minArtifactSize
1 KB
β οΈ Warn
Verify that the build output is complete and dependencies are included.
Too Large Issues
Artifacts that exceed the maximum allowed size threshold. This typically indicates unoptimized bundles, accidental inclusion of large files, or missing code splitting strategies.
Configuration: scoring.artifactSize
Example Issues:
Severity
Message
Source file
Location
π¨ error
main.js is 6.12 MB (exceeds 5 MB); consider splitting or compressing this bundle.
dist/lib/main.js
π¨ error
vendor.js is 2.05 MB (exceeds 1.5 MB); apply tree-shaking or extract shared dependencies.
dist/lib/vendor.js
Use Cases:
Code Splitting: Break large bundles into smaller chunks
Tree Shaking: Remove unused code from dependencies
Compression: Enable gzip/brotli compression
Asset Optimization: Optimize images and other assets
Lazy Loading: Load code only when needed
Too Small Issues
Artifacts that fall below the minimum expected size threshold. This could signal missing dependencies, incomplete builds, or configuration issues.
Configuration: scoring.artifactSize
Example Issues:
Severity
Message
Source file
Location
β οΈ warning
utils.js is 50 kB (below 100 kB); confirm that expected dependencies are included.
dist/lib/utils.js
β οΈ warning
styles.css is 10 B (below 1 kB); confirm that expected dependencies are included.
dist/lib/styles.css
Use Cases:
Dependency Check: Verify all required dependencies are included
Build Verification: Ensure the build process completed successfully
Configuration Review: Check bundler configuration for missing entries
Artifacts containing imports that match forbidden glob patterns. This helps enforce dependency policies and prevent usage of deprecated or unsafe libraries.
Configuration: scoring.blacklist
Example Issues:
Severity
Message
Source file
Location
π¨ error
node_modules/old-charting-lib/index.js matches a blacklist pattern; remove or replace this dependency.
src/main-ASDFGAH.js
Use Cases:
Dependency Replacement: Replace blacklisted libraries with approved alternatives
Code Refactoring: Remove usage of forbidden dependencies
Policy Review: Update dependency policies if needed
Security Audit: Investigate security implications of blacklisted dependencies
Insights Table
The insights table summarizes different areas of the selected files by grouping data based on patterns. It aggregates bytes from outputs, their inputs, and overhead.
Process for accurate data:
For each group, evaluate its patterns and:
Sum bytes from inputs whose paths match the pattern
Include output file bytes if the file path matches the pattern (including bundler overhead)
Each byte can only be assigned once to avoid duplication.
After processing:
Unmatched bytes go to the fallback "Rest" group
Remaining bundler overhead (from unmatched outputs) is also included in Rest
The dependency tree provides users with a quick understanding of the dependencies graph of selected artifacts. It serves as a replacement for opening bundle stats in the browser to search for respective files.
The grouping table provides a summary view of bundle statistics organized by user-defined groups. It aggregates file sizes and counts for quick analysis of different parts of your bundle.
stats.json
βββ outputs
βββ dist/app.js
βββ π― src/index.ts // included by **/src/**
βββ π― src/feature-1.ts // included by **/src/**
βββ π― src/feature-2.ts // included by **/src/**
βββ β src/utils/format.ts // excluded by **/utils/**
Table Result:
Group
Modules
Size
Application Code
3
225 kB
Rest
-
275 kB
Grouping - Icons and Titles
Customize group display with icons and titles, or let titles be auto-generated from patterns.
Small and Tiny features were moved to Rest due to minSize threshold
Implementation details
Limitations
From feedback sessions on this issue we collected a couple of things that popped up regularly but are not directly possible with the plugin.
Any action triggered by a comparison of 2 measures.
increased size by X%
increased size by XkB
increased files by X
For example to implement a failing CI on 20% increase for a specific audit you would have to read the comparison json created by the GH action or over the @code-pushup/ci package directly and process it with your custom logic.
Data Processing Pipeline
flowchart LR
subgraph Stats Generation
A[Esbuild β stats.json]
B[Webpack β stats.json]
C[Vite β stats.json]
end
D[Unify Stats]
E[Merge Options]
F[Group Stats by Audits]
G[Compute Size Scores]
H[Compute Issue Penalties]
I[Score Audit]
subgraph Generate Audits
J[Add Issues]
K[Add Table]
L[Add Tree]
end
A --> D
B --> D
C --> D
D --> E
E --> F
F --> G
F --> H
G --> I
H --> I
I --> J
J --> K
K --> L
Loading
Plugin Configuration
The plugin integrates with supported bundlers to analyze bundle statistics and generate audit reports. Configure the plugin with bundler type, artifact paths, and audit settings.
The plugin can generate artefacts from the stats.json file. The plugin can either use an existing stats.json file or generate a new one if the generateArtefacts option is provided.
selection - The filtering of output files to analyse
scoring - The scoring penalty (not the totalSize) to use (penalty)
artefactTree - The artefact tree to use (pruning, grouping, formatting)
// π Options Merging β Plugin vs Audit-Level ConfigconstpluginOptions: PluginOptions={artefactTree: {groups: ['shared/'],// π₯ merged into audit.artefactTree.groupspruning: {maxDepth: 3},// β overwritten by audit.artefactTree.pruning},insightsTable: ['node_modules','zone.js'],// π₯ merged into audit.insightsTableselection: {}scoring: {penalty: {artefactSize: [0,3_000_000],blacklist: ['/*.min.js'],// π₯ merged into audit.penalty.blacklist},},audits: [{title: 'Initial Size Audit',scoring: {totalSize: 500_000,// π overwrites plugin totalSizepenalty: {blacklist: ['/legacy/'],// π₯ merged with plugin.penalty.blacklist},},insightsTable: ['feature:core'],// π₯ merged with plugin.insightsTableartefactTree: {groups: ['features/**'],// π₯ merged with plugin.artefactTree.groupspruning: {maxChildren: 10},// β overwrites plugin.artefactTree.pruning},},],};
Audit Configuration
Each audit defines a specific bundle analysis with its own selection criteria, scoring thresholds, and reporting options. Audits can override plugin-level settings or inherit them for consistency across multiple audits.
path: relative paths to files. The only mandatory option.
It could be a path "index.js", a [pattern] "dist/app-*.js"
or an array ["index.js", "dist/app-*.js", "!dist/app-exclude.js"].
import: partial import to test tree-shaking. It could be "{ lib }"
to test import { lib } from 'lib', * to test all exports,
or { "a.js": "{ a }", "b.js": "{ b }" } to test multiple files.
limit: size or time limit for files from the path option. It should be
a string with a number and unit, separated by a space.
Format: 100 B, 10 kB, 500 ms, 1 s.
name: the name of the current section. It will only be useful
if you have multiple sections.
message: an optional custom message to display additional information,
such as guidance for resolving errors, relevant links, or instructions
for next steps when a limit is exceeded.
gzip: with true it will use Gzip compression and disable
Brotli compression.
brotli: with false it will disable any compression.
ignore: an array of files and dependencies to exclude from
the project size calculation.
π¦ Bundle Budget Plugin
Bundle size tracking for your build artifacts
Track, compare, and prevent bundle size regressions to maintain web performance (e.g. LCP) across product areas.
π§ͺ Reference PR
π #1024 β BundleBudget Plugin PoC Implementation
User story
As a developer, I want to track bundle size regressions per product area and route,
so that we can avoid performance regressions and optimize LCP over time.
The plugin should:
stats.jsonoutput from different bundler./route-1,/route-2).Metric
Bundle size in bytes.
Parsed from
--stats-jsonoutput and grouped by file.13234113.4 MB / 13 FilesIntegration Requirements
The plugin can be implemented in 2 ways:
As stats file serve significantly more details and are state of the art when debugging bundle size this issue favours this approach.
Using Stats Files
Bundle stats are detailed metadata about your build outputsβlisting each generated file, its original inputs, and any static importsβexported via a metafile (e.g. from ESBuild or other bundlers).
Generate a stats file with ESBuild:
The resulting file maintains the following data structure:
EsbuildBundleStats # Root object containing all bundle stats βββ inputs (Record<string, MetafileInput>) # Map of each source input file to its metadata β βββ <inputPath> # File path of a specific input module β βββ bytes: number # Size of this input module in bytes β βββ imports (MetafileImport[]) # List of static imports declared by this input β βββ [ ] # Array of import entries β βββ path: string # Resolved filesystem path of the imported module β βββ kind: ImportKind # Import type (e.g. "import", "require", "dynamic") β βββ external?: boolean # True if marked external (excluded from bundle) β βββ original?: string # Original import specifier in source code βββ outputs (Record<string, MetafileOutput>)# Map of each generated output file to its metadata βββ <outputPath> # File path of a specific output chunk βββ bytes: number # Total size of this output file in bytes βββ inputs (Record<string,MetafileOutputInput>) # Map of input modules contributing to this output β βββ <inputPath> # Path of an input that fed into this output β βββ bytesInOutput: number # Number of bytes this input contributed to the output βββ imports (MetafileImport[]) # List of static imports found in this output β βββ [ ] # Array of import entries β βββ path: string # Resolved filesystem path of the imported module β βββ kind: ImportKind # Import type (e.g. "import", "require", "dynamic") β βββ external?: boolean # True if marked external (excluded from bundle) β βββ original?: string # Original import specifier in source code βββ exports: string[] # List of named exports provided by this bundle βββ entryPoint?: string # Entry-point module path for this output chunk, if anyFile Type Definitions
inputsRecord<string, MetafileInput>importsMetafileImport[]path,kind, and optional flags.outputsRecord<string, MetafileOutput>entryPointstring(optional)The plugin will use this information to gather the configured artefact groups.
Crawling the filesystem
Note
No research done as not scaleable
Setup and Requirements
π¦ Package Dependencies
--metafile/stats.json.π Configuration Files
angular.json/vite.config.tsor equivalent β for custom build config.Bundle Stats
The following is a minimal stats representation used to explain different features of the plugin. It will be referred to as Example Stats.
Features
@todo
General
The audit name is provided over the
titleproperty. Internally a auditslugis derived from thetitle: A unique identifier for this group.description: One two sentences explaining the purpose of the auditTypes
Example Configuration
Every audit gets the merged configuration of the global and audit specific configuration listed in the description.
Configuration Example
Report Output
Selection
To select files for an audit, glob patterns are used to include and exclude parts of the output files.
All options are provided as glob patterns matching either
path,pathininputsorentryPoint.Types
Example Configuration
Selection Behaviour
*,**,?,[abc].include*patterns (for outputs and inputs), followed byexclude*to remove matches.includeandexclude, it will be excluded.mode:'bundle'and'onlyMatching'ignore imports.'withAllDependencies'and'withStartupDependencies': preserve imports even if excludedInclude Output
Select only
dist/index.jsand its dependencies.Selection Options
Selection Result:
The target output and its imported dependencies are included.
Include/Exclude Output
Select all outputs except bin files.
Selection Options
Selection Result:
All outputs are included except those matching the exclude pattern.
Include Input
Select outputs that contain specific input files.
Selection Options
Selection Result:
Only outputs containing the specified input files are included.
Include/Exclude Input
Select all outputs but exclude those containing feature-2 files.
Selection Options
Selection Result:
Outputs containing the excluded input files are filtered out.
Include/Exclude Mixed
Select feature outputs but exclude utility files.
Selection Options
Selection Result:
Complex filtering combines output and input patterns for precise selection.
Mode:
onlyMatchingSelect only input files that match a pattern β exclude outputs, imports, and bundler overhead.
Selection Options
Selection Result:
Only the bytes from matching input files are counted, excluding bundler overhead.
Mode:
bundleInclude the full output bundle with overhead and its bundled inputs but not external chunks.
Selection Options
Selection Result:
Only what's bundled directly in the output file is included.
Mode:
withStartupDepsInclude the output and all static imports required at startup.
Selection Options
Selection Result:
Static imports are preserved even if they would be excluded by patterns.
Mode:
withAllDepsInclude the output and all imported files β both static and dynamic.
Selection Options
Selection Result:
Both static and dynamic dependencies are included in their entirety.
Scoring
The plugin assigns a score in the range
[0 β¦ 1]to each artefact (or artefact selection) based on:A perfect score (
1) means βwithin budgetβ; lower values indicate regressions.The selection process of a scored set of files is explained in detail in File Selection
Types
Example Configuration
Total Size
Every artefact selection has budgets assigned under
budget.totalSize: Total bytes of all files in a selection.Examples
Panelties
To give actionable feedback to users of the plugin you can add penalties a set of penalties:
artefactSize: Byte size of a files in a selection.blacklist: List of globs to flag inputs as well as imports as forbiddenTypes
Example Configuration
Scoring Parameters
SMEWwe1)ww0.5)Size score
Issues penalty
Final blended score
xychart-beta title "Score vs Artifact Size (with penalty shift)" x-axis [0, 1, 1.25, 1.5, 1.75, 2] y-axis "Score" 0 --> 1 line Original [1, 1, 0.75, 0.5, 0.25, 0] line Penalized [0.5, 0.5, 0.25, 0, 0, 0]Issues
To give users actionable feedback we need to be able to tell WHAT happened, WHERE it is, and HOW to fix it.
Issues are configured per audit under the
scoring.penaltyproperty.The plugin creates diagnostics for each penalty. The table below shows all diagnostic types:
blacklistmaxArtifactSize5 MBminArtifactSize1 KBToo Large Issues
Artifacts that exceed the maximum allowed size threshold. This typically indicates unoptimized bundles, accidental inclusion of large files, or missing code splitting strategies.
Configuration:
scoring.artifactSizeExample Issues:
main.jsis 6.12 MB (exceeds 5 MB); consider splitting or compressing this bundle.dist/lib/main.jsvendor.jsis 2.05 MB (exceeds 1.5 MB); apply tree-shaking or extract shared dependencies.dist/lib/vendor.jsUse Cases:
Too Small Issues
Artifacts that fall below the minimum expected size threshold. This could signal missing dependencies, incomplete builds, or configuration issues.
Configuration:
scoring.artifactSizeExample Issues:
utils.jsis 50 kB (below 100 kB); confirm that expected dependencies are included.dist/lib/utils.jsstyles.cssis 10 B (below 1 kB); confirm that expected dependencies are included.dist/lib/styles.cssUse Cases:
Blacklisted Issues
Artifacts containing imports that match forbidden glob patterns. This helps enforce dependency policies and prevent usage of deprecated or unsafe libraries.
Configuration:
scoring.blacklistExample Issues:
node_modules/old-charting-lib/index.jsmatches a blacklist pattern; remove or replace this dependency.src/main-ASDFGAH.jsUse Cases:
Insights Table
The insights table summarizes different areas of the selected files by grouping data based on patterns. It aggregates bytes from outputs, their inputs, and overhead.
Process for accurate data:
For each group, evaluate its patterns and:
Each byte can only be assigned once to avoid duplication.
After processing:
Types
Complete Example Configuration
Example Output:
Dependency Tree
The dependency tree provides users with a quick understanding of the dependencies graph of selected artifacts. It serves as a replacement for opening bundle stats in the browser to search for respective files.
Types
Example Configuration
Mode:
allShows complete dependency tree including all outputs, inputs, and imports with full bundler overhead.
Tree Configuration
Tree Result:
Mode:
onlyMatchingShows only the bytes that match selection patterns, excluding bundler overhead.
Tree Configuration
Tree Result:
Grouping - Disabled
Tree Result:
example-group βββ entry-2.js βββ node_modules/@angular/router/provider.ts βββ node_modules/@angular/router/service.ts β βββ node_modules/@angular/router/utils.ts βββ node_modules/lodash/chunk.jsGrouping - Basic
Grouping Configuration
Tree Result:
example-group βββ entry-2.js βββ π °οΈ Angular Router β βββ node_modules/@angular/router/provider.ts β βββ node_modules/@angular/router/service.ts β βββ node_modules/@angular/router/utils.ts βββ node_modules/lodash/chunk.jsGrouping - Include/Exclude
GroupingRule supports flexible pattern matching with include/exclude logic:
include: Patterns to match files for inclusion in the groupexclude: Patterns to exclude from the group (optional)Advanced Grouping Configuration
Grouping - NumSegments
The
numSegmentsproperty controls how files are grouped by their path structure.Without numSegments:
example-group βββ entry.js βββ src/components/ui/Button.tsx βββ src/components/ui/Modal.tsx βββ src/components/forms/Input.tsx βββ src/components/forms/Select.tsxGrouping Configuration
With numSegments:
example-group βββ entry.js βββ Components βββ ui β βββ Button.tsx β βββ Modal.tsx βββ forms βββ Input.tsx βββ Select.tsxPruning - MaxChildren
Unpruned:
Pruning Configuration
Pruned Result:
Pruning - MinSize
With small files:
example-group 840 kB 10 files βββ index.js 840 kB 9 files βββ src/app.js 400 kB βββ src/large-1.js 200 kB βββ src/medium-1.js 100 kB βββ src/small-1.js 30 kB βββ src/small-2.js 25 kB βββ src/small-3.js 20 kB βββ β¦ 4 more files 65 kBPruning Configuration
Pruned Result:
example-group 840 kB 10 files βββ index.js 840 kB 9 files βββ src/app.js 400 kB βββ src/large-1.js 200 kB βββ src/medium-1.js 100 kB βββ β¦ 6 more files 140 kBPruning - StartDepth
Controls the depth at which the tree analysis begins, useful for skipping top-level wrapper nodes.
Without startDepth:
example-group βββ main-bundle βββ app-core βββ src/components/Button.tsx βββ src/components/Modal.tsx βββ src/utils/helpers.tsPruning Configuration
With startDepth:
Pruning - PathLength
Controls how long file paths can be before truncation, or disables truncation entirely.
Full path:
Pruning Configuration
Shortened path:
Disable truncation:
Formatting - Size
Raw bytes:
Formatted:
Formatting - Pluralization
Unpluralized:
Pluralized:
Formatting - RedundantInfo
With redundancy:
example-group 300 kB 3 modules βββ index.js 100 kB 1 module βββ src/app.js 100 kB 1 module βββ β¦ 2 more inputs 200 kB 2 modulesCleaned up:
example-group 300 kB 3 modules βββ index.js 100 kB βββ src/app.js βββ β¦ 2 more inputs 200 kBInsights Table
The grouping table provides a summary view of bundle statistics organized by user-defined groups. It aggregates file sizes and counts for quick analysis of different parts of your bundle.
Types
Example Configuration
Mode:
allShows complete bundle statistics including outputs, inputs, imports and bundler overhead.
Table Configuration
Table Result:
Mode:
onlyMatchingShows only the bytes that match selection patterns, excluding bundler overhead.
Table Configuration
Table Result:
Grouping - Include
Select files using single or multiple glob patterns.
Group Configuration
Table Result:
Grouping - Include/Exclude
Combine include and exclude patterns for precise file selection.
Group Configuration
File Matching:
stats.json βββ outputs βββ dist/app.js βββ π― src/index.ts // included by **/src/** βββ π― src/feature-1.ts // included by **/src/** βββ π― src/feature-2.ts // included by **/src/** βββ β src/utils/format.ts // excluded by **/utils/**Table Result:
Grouping - Icons and Titles
Customize group display with icons and titles, or let titles be auto-generated from patterns.
Manual Titles with Icons:
Table Result:
Auto-Generated Titles:
Table Result:
Grouping - NumSegments
Control how paths are grouped using the
numSegmentsproperty for hierarchical organization.Without numSegments:
Group Configuration
With numSegments (creates subgroups):
βββ Components βββ ui (Button.tsx, Modal.tsx) βββ forms (Input.tsx, Select.tsx)Rest Group - Unmatched Files
Files that don't match any group pattern are collected in the "Rest" group.
Group Configuration
File Matching:
stats.json βββ outputs βββ dist/app.js 300kB βββ π― src/feature-1.ts // matches group βββ π― src/feature-2.ts // matches group βββ β src/index.ts // unmatched -> Rest βββ β src/utils/format.ts // unmatched -> RestTable Result:
Rest Group - Bundler Overhead
When using
onlyMatchingmode, bundler overhead becomes part of the Rest group.Group Configuration
File Analysis:
Table Result:
Pruning - Max Children
Limit the number of groups displayed in the table.
Group Configuration
Table Result:
Utils and Helpers groups were moved to Rest due to maxChildren limit
Pruning - Min Size
Filter out groups smaller than the specified threshold.
Group Configuration
Table Result:
Small and Tiny features were moved to Rest due to minSize threshold
Implementation details
Limitations
From feedback sessions on this issue we collected a couple of things that popped up regularly but are not directly possible with the plugin.
For example to implement a failing CI on 20% increase for a specific audit you would have to read the comparison json created by the GH action or over the
@code-pushup/cipackage directly and process it with your custom logic.Data Processing Pipeline
flowchart LR subgraph Stats Generation A[Esbuild β stats.json] B[Webpack β stats.json] C[Vite β stats.json] end D[Unify Stats] E[Merge Options] F[Group Stats by Audits] G[Compute Size Scores] H[Compute Issue Penalties] I[Score Audit] subgraph Generate Audits J[Add Issues] K[Add Table] L[Add Tree] end A --> D B --> D C --> D D --> E E --> F F --> G F --> H G --> I H --> I I --> J J --> K K --> LPlugin Configuration
The plugin integrates with supported bundlers to analyze bundle statistics and generate audit reports. Configure the plugin with bundler type, artifact paths, and audit settings.
Types
Minimal Example Configuration
Artefacts Gathering
The plugin can generate artefacts from the
stats.jsonfile. The plugin can either use an existingstats.jsonfile or generate a new one if thegenerateArtefactsoption is provided.Types
Example Configuration:
Full Example Configuration:
Options Merging
The Plugin and audit share a set of options:
insightsTable- The insights to use (grouping)selection- The filtering of output files to analysescoring- The scoring penalty (not the totalSize) to use (penalty)artefactTree- The artefact tree to use (pruning, grouping, formatting)Audit Configuration
Each audit defines a specific bundle analysis with its own selection criteria, scoring thresholds, and reporting options. Audits can override plugin-level settings or inherit them for consistency across multiple audits.
Types
Minimal Example Configuration
Full Example Configuration
Market Research - Viewer
sonda.dev
Repo: https://sonda.dev/
Market Research - CI
SizeLimit
Repo: https://github.com/ai/size-limit
Setup
Relevant Options:
It could be a path
"index.js", a [pattern]"dist/app-*.js"or an array
["index.js", "dist/app-*.js", "!dist/app-exclude.js"]."{ lib }"to test
import { lib } from 'lib',*to test all exports,or
{ "a.js": "{ a }", "b.js": "{ b }" }to test multiple files.pathoption. It should bea string with a number and unit, separated by a space.
Format:
100 B,10 kB,500 ms,1 s.if you have multiple sections.
such as guidance for resolving errors, relevant links, or instructions
for next steps when a limit is exceeded.
trueit will use Gzip compression and disableBrotli compression.
falseit will disable any compression.the project size calculation.
Bundle Stats
repo: https://github.com/relative-ci/bundle-stats?tab=readme-ov-file
Setup
Relevant Options
compare| Enable comparison to baseline bundlebaseline| Save stats as baseline for future runshtml| Output visual HTML reportjson| Output JSON snapshotstats| (advanced) Customize Webpack stats passed into pluginsilent| Disable loggingBundleMon
Repo: https://github.com/LironEr/bundlemon
Setup
Relevant Options
path(string, required) β Glob pattern relative to baseDir (e.g."**/*.js")friendlyName(string, optional) β Human-readable name (e.g."Main Bundle")compression("none" | "gzip", optional) β Override default compression (e.g."gzip")maxSize(string, optional) β Max size:"2000b","20kb","1mb"maxPercentIncrease(number, optional) β Max % increase:0.5= 0.5%,4= 4%,200= 200%