performance.printFileSize
- Type:
- Default:
true
Whether to print the file sizes after production build.
Default outputs
The default output log is as follows:
Disable outputs
If you do not want to print any information, you can disable it by setting printFileSize to false:
Options
You can customize the output format through the options.
total
- Type:
- Default:
true
Whether to output the total size of all static assets, or provide a function to customize the output format of the total size.
When set to false, the total size will not be output:
If the current build only generates one static asset, the total size will not be printed.
When set to a function, you can customize the total size output format:
Function parameters:
environmentName: The unique name of the current environment, used to distinguish and locate the environmentdistPath: The output directory relative to the project rootassets: Array of static assets, each containingnameandsizepropertiestotalSize: Total size of all static assets in bytestotalGzipSize: Total gzip-compressed size of all static assets in bytes. Set to0when gzip size reporting is disabled.totalBrotliSize: Total Brotli-compressed size of all static assets in bytes. Set toundefinedwhen Brotli size reporting is disabled.
detail
- Type:
boolean - Default:
true
Whether to output the size of each static asset.
If you do not need to view the size of each static asset, you can set detail to false. In this case, only the total size will be output:
compressed
- Type:
boolean | { type?: 'gzip' | 'brotli'; level?: number } - Default:
falsewhen output.target isnode, otherwisetrue
Controls whether to calculate and print compressed asset sizes after a build. Set to true to report gzip sizes, false to skip compression calculations, or an object to configure the algorithm and level.
Calculating compressed sizes adds to build time. If you do not need compressed size reporting, set compressed to false to skip these calculations:
- This option only reports sizes; it does not generate compressed files. To serve compressed assets, you typically need to configure compression on your server or CDN. Actual transfer sizes depend on those compression settings.
- For non-compressible assets (such as images), the compressed size is not shown in the detailed list, but their original size is included in the total compressed size.
- When
diffis enabled, Rsbuild compares compressed sizes only when both builds use the same algorithm. Changes caused by adjustinglevelare included in the compressed size diff. Comparisons of uncompressed sizes are unaffected by these settings.
type
- Type:
'gzip' | 'brotli' - Default:
'gzip'
Selects the compression algorithm used to calculate asset sizes:
For example, to report Brotli sizes:
Brotli can take longer than gzip, especially when the build produces many assets or large files.
level
- Type:
number - Default:
6
Sets the compression level. The valid range depends on the algorithm:
- gzip: An integer from
0to9. - Brotli: An integer from
0to11, corresponding to Brotli's quality parameter.
For example, use Brotli's highest level to estimate the size of assets precompressed at level 11:
Higher levels generally produce smaller files but take longer to calculate. Brotli level 11 can be particularly slow. To estimate production transfer sizes, use the same algorithm and level as your server or CDN.
include
- Type:
- Default:
undefined
A filter function to determine which static assets to print.
If returned false, the static asset will be excluded and not included in the total size or detailed size.
For example, only output static assets larger than 10 kB:
Or only output .js files larger than 10 kB:
exclude
- Type:
- Default:
(asset) => /\.(?:map|LICENSE\.txt|d\.(?:ts|mts|cts))$/.test(asset.name)
A filter function to determine which static assets to exclude. If both include and exclude are set, exclude will take precedence.
Rsbuild defaults to excluding source map, license files, and .d.ts, .d.mts, or .d.cts type declaration files, as these files do not affect page load performance.
For example, exclude .html files in addition to the default:
diff
- Type:
boolean - Default:
false
Controls whether file size differences are displayed relative to the previous build.
When this option is enabled, Rsbuild records a snapshot of all output file sizes after each build. On subsequent builds, Rsbuild compares the current sizes against the previous snapshot and shows the change inline in parentheses.
To enable diff output:
On the second build, the output begins to include inline size deltas:
- Increases are highlighted in red with a
+prefix - Decreases are highlighted in green with a
-prefix - Files with no change omit the diff indicator
Snapshots are stored at <root>/node_modules/.cache/rsbuild/file-sizes-[hash].json, where [hash] is derived from the Rsbuild configuration file path.

