Learn more about the bundle metrics and data extracted by bundle-stats for assets, modules and packages.
Assets
List of files generated by the bundler
- webpack ignores assets that match
excludeAssets
webpack stats option - bundle-stats ignores assets with
.map
and.LICENSE.txt
extensions
Data
Name | Description |
---|---|
Size | Size of the file outputted by the bundler |
Chunk | The originating chunk |
Asset type | Bundler asset type: entry , initial , chunk , other |
File type | Output file type: JS , CSS , IMG , Media , Fonts , HTML , Other |
Metrics
Name | Description | Change up/down |
---|---|---|
Bundle Size | Total file size of the assets generated or processed by the bundler | regression /improvement |
Total size by type | Total file size by file type(ex: CSS , JS , IMG , Media , Fonts , Html , and Other ) | regression /improvement |
Initial JS | Total file size of the JavaScript initial chunks | regression /improvement |
Initial CSS | Total file size of the CSS initial chunks | regression /improvement |
Cache Invalidation | Ratio between the total file size of the changed assets and the total file size(Bundle Size) | neutral |
Chunks | Total number of chunks generated by the bundler | neutral |
Assets | Total number of assets generated or produced by the bundler | neutral |
Learn more about asset path normalization
To identify and compare assets between different builds, bundle-stats extracts the hash from the file path when possible:
Hash digest | Bundler asset file path | bundle-stats asset normalized file path |
---|---|---|
hex | assets/vendors.abc1234.js assets/vendors-abc1234.js assets/vendors_abc1234.js assets/vendors.abc1234.js | assets/vendors.js |
base64 | assets/vendors.fGEff4Ab.js assets/vendors~fGEff4Ab.js | assets/vendors.js |
To update your bundle configuration to use a common pattern for asset file paths, follow the corresponding guide:
Modules
List of modules included in the bundle
- webpack ignores modules that match
excludeModules
webpack stats option - bundle-stats ignores modules that are not bundled into any chunks
Data
Name | Description |
---|---|
Size | Webpack - module source size before any transformation(ex: babel, typescript, etc) or production optimization(module hoisting, tree-shaking, minification, etc.) Vite/rollup - module rendered or source size before any production optimization(module hoisting, tree-shaking, minification, etc.) Read more about module size and chunk size |
Source | First/Third party code |
Chunk | Parent asset chunk |
File type | Module file type: JS , CSS , Other |
Module size and chunk size
Bundlers report specific sizes for each module, however, the value does not represent the actual size that the module contributes to the chunk output.
The reported values are based on different sources, either the module source or transformed, and do not consider the steps performed after the modules are combined into a chunk, such as module hoisting, tree-shaking, code duplication removal, minification, or bundler utilities.
While the reported total size of the modules belonging to a chunk is not equal to the chunk output size, bundle-stats analysis allows you to understand how module changes impact the chunk size.
Metrics
Name | Description | Change up/down |
---|---|---|
Modules | Total number of bundled modules | neutral |
Duplicate Modules (bundle-stats@3.3.0 ) | Total number of modules bundled into more than one chunk | regression /improvement |
Duplicate Code (bundle-stats@3.3.0 ) | Percentage of total duplicate module size from the total module size | neutral |
From bundle-stats@v4, the modules metric counts all the duplicate module instances - bundle-stats#2122.
v1-v3 | v4 | |
---|---|---|
modules | 100 | 110 |
duplicateModules | 10 | 10 |
Packages
List of bundled packages
Data
Name | Description |
---|---|
Size | The package total module size |
Metrics
Name | Description | Change up/down |
---|---|---|
Packages | Total number of bundled packages | regression /improvement |
Duplicate Packages | Total number of duplicate packages | regression /improvement |