The content of this section is derived from the content of the following links and is subject to the CC BY 4.0 license.
The following contents can be assumed to be the result of modifications and deletions based on the original contents if not specifically stated.
Generate packaging information that can be used to analyze module dependencies and optimize compilation speed.
@rspack/cli
, rspack build --json stats.json
.stats.toJson(options)
、stats.toString(options)
.boolean | string | Object
{"preset":"errors-warnings","timings":true}
Preset | Description |
---|---|
'normal' (true ) |
Output by default value of stats options |
'none' (false ) |
Output nothing |
'verbose' |
Output everything |
'errors-only' |
Output only error-related information |
'errors-warnings' |
Output only error and warning related information |
'minimal' |
Output only when errors or new compilation happen |
'detailed' |
Output everything except chunkModules and chunkRootModules |
'summary' |
Output only the summary information |
You can specify exactly which packing information to output, all the following fields are optional.
boolean
undefined
A fallback value for stats options when an option is not defined. It has precedence over local Rspack defaults.
Enabling stats.all
will lead to a large amount of data transmission between Rust and JavaScript, which will significantly increase the time consumption for stats generation. Please use it with caution.
boolean | string
undefined
Sets the preset for the type of information that gets displayed. It is useful for extending stats behaviours.
boolean
true
Whether to display the asset information. See Asset Object for more details.
string
"id"
Sort the assets by a given field. All of the sorting fields are allowed to be used. Use !
prefix in the value to reverse the sort order by a given field.
number
15
How many items of assets should be displayed (groups will be collapsed to fit this space).
boolean
false
Whether to display information about assets that are related to other assets (like SourceMaps for assets).
Array<string | RegExp | (name: string) => boolean> | string | RegExp | (name: string) => boolean | false
false
Exclude the matching assets information. This can be done with a string, a RegExp, a function that is getting the assets name as an argument and returns a boolean. stats.excludeAssets
can be an array of any of the above.
boolean
true
Whether to display information about the cached assets. Setting stats.cachedAssets
to false
will tell stats to only show the emitted files (not the ones that were built).
boolean
Whether to group assets by how their are related to chunks.
boolean
Whether to group assets by their status (emitted, compared for emit or cached).
boolean
Whether to group assets by their extension.
boolean
Whether to group assets by their asset info (immutable, development, hotModuleReplacement, etc).
boolean
Whether to group assets by their asset path.
boolean
true
Whether to display information about the chunk, see chunk object for more details.
boolean
true
Whether to display information about the built modules to information about the chunk.
number
10
How many items of chunk modules should be displayed (groups will be collapsed to fit this space).
boolean
false
Whether to display chunk modules that are dependencies of other modules of the chunk.
boolean
true
Whether to display information about the origins of chunks and chunk merging.
boolean
false
Whether to display chunk parents, children and siblings.
string
"id"
Sort the chunks by a given field. All of the sorting fields are allowed to be used. Use !
prefix in the value to reverse the sort order by a given field.
boolean
false
Whether to display IDs of modules and chunks.
boolean
true
Whether to display information about the namedChunkGroups
, see chunk group object for more details.
boolean
true
Whether to display auxiliary assets in chunk groups.
boolean
true
Whether to display children of the chunk groups (e.g. prefetched, preloaded chunks and assets).
number
5
How many assets should be displayed in chunk groups.
boolean | 'auto'
false
Whether to display the entry points with the corresponding bundles, , see entrypoint object for more details.
When stats.entrypoints
is set to 'auto'
, Rspack will decide automatically whether to display the entry points in the stats output.
boolean
true
Whether to display information about the built modules, see module object for more details.
boolean
true
Whether to display dependencies and the origin of warnings/errors.
boolean
true
Whether to add information about assets inside modules.
number
15
How many items of modules should be displayed (groups will be collapsed to fit this space).
string
"id"
Sort the modules by a given field. All of the sorting fields are allowed to be used. Use !
prefix in the value to reverse the sort order by a given field.
boolean
true
Whether to display information about the reasons of why modules are included.
number
1000
How many characters should the reasons be displayed (groups will be collapsed to fit this space).
boolean
false
Whether to display the source code of modules.
boolean
false
Whether to display the distance from the entry point for each module.
boolean
false
Whether to display the orphan modules.
A module is an orphan if it is not included in any chunk.
boolean
true
Whether to display information about runtime modules.
The runtime modules are built-in modules of Rspack, used to provide various runtime capabilities.
boolean
true
Whether to display information about cached (not built) modules.
Array<string | RegExp | (name: string) => boolean> | string | RegExp | (name: string) => boolean | false
false
Exclude the matching modules information. This can be done with a string, a RegExp, a function that is getting the modules name as an argument and returns a boolean. stats.excludeAssets
can be an array of any of the above.
boolean
true
Whether to display information about modules nested in other modules (like with module concatenation).
number
10
How many items of nested modules should be displayed (groups will be collapsed to fit this space).
boolean
Whether to group modules by their attributes (errors, warnings, assets, optional, orphan, or dependent).
boolean
Whether to group modules by their cache status (cached or built and cacheable).
boolean
Whether to group modules by their extension.
boolean
Whether to group modules by their path.
boolean
Whether to group modules by their type.
boolean
Whether to group modules by their layer.
boolean
Group reasons by their origin module to avoid large set of reasons.
boolean
false
Whether to display the exports of the modules.
boolean
false
Whether to display which exports of a module are used.
boolean
false
Whether to display the reasons why optimization bailed out for modules.
boolean
true
Whether to display the errors.
boolean
true
Whether to display the errors count.
boolean
false
Whether to display the details to the errors. It defaults to 'auto'
which will show error details when there're only 2 or less errors.
number
5
How many lines should an error be displayed.
boolean
true
Whether to display stack trace of errors.
boolean
true
Whether to display the warnings.
boolean
true
Whether to display the warnings count.
number
5
How many lines should a warning be displayed.
'info' | 'none' | 'error' | 'warn' | 'log' | 'verbose' | boolean
Whether to add logging output:
'none'
, false
: disable logging'error'
: errors only'warn'
: errors and warnings only'info'
: errors, warnings, and info messages'log'
, true
: errors, warnings, info messages, log messages, groups, clears. Collapsed groups are displayed in a collapsed state.'verbose'
: log everything except debug and trace. Collapsed groups are displayed in expanded state.Array<string | RegExp | function (name) => boolean>
Whether to display the debug information of the specified loggers such as Plugins or Loaders. When stats.logging
is set to false
, stats.loggingDebug
option is ignored.
boolean
true
Whether to display stack traces in the logging output for errors, warnings and traces.
boolean
false
Whether to output in the different colors.
Defaults to true
when executing rspack build
in an environment that supports color output.
boolean
true
Whether to display information about the hash of the compilation.
boolean
false
Whether to display the --env
information.
boolean
true
Whether to display the build date and the build time information.
boolean
true
Whether to add information about the Rspack version used.
string
Whether to display the base directory, an absolute path for shortening the request information.
boolean
true
Whether to display the publicPath
.
boolean
true
Whether to display the output.path
.
boolean
true
Whether to display the output.path
.
boolean
true
Whether to display performance hint when the file size exceeds performance.maxAssetSize
.
boolean
true
Whether to display the timing information.
For assetsSort
, chunksSort
and modulesSort
there are several possible fields that you can sort items by:
'id'
: the item's id, an item is an asset, a module or a chunk.'name'
: the item's name that was assigned to it upon importing.'size'
: the size of item in bytes.'chunks'
: what chunks the item originates from (for example, if there are multiple subchunks for one chunk: the subchunks will be grouped according to their main chunk).'errors'
: number of errors in items.'warnings'
: number of warnings in items.'failed'
: whether the item has failed compilation.'cacheable'
: whether the item is cacheable.'built'
: whether the item has been built.'prefetched'
: whether the item will be prefetched.'optional'
: whether the item is optional.'identifier'
: identifier of the item.'index'
: item's processing index.'profile'
: items's processing cost.'issuer'
: the identifier of the issuer.'issuerId'
: the id of the issuer.'issuerName'
: the name of the issuer.'issuerPath'
: the full issuer path.If you want to use the preset output behavior but want to output more or less of individual fields, you can customize the output behavior of the fields after specifying preset or all.
For example, only the error and the reason why the module was introduced are output.