object string
The stats option lets you precisely control what bundle information gets displayed. This can be a nice middle ground if you don't want to use quiet or noInfo because you want some bundle information, but not all of it.
export default {
// ...
stats: "errors-only",
};Webpack comes with certain presets available for the stats output:
| Preset | Alternative | Description |
|---|---|---|
'errors-only' | none | Only output when errors happen |
'errors-warnings' | none | Only output errors and warnings happen |
'minimal' | none | Only output when errors or new compilation happen |
'none' | false | Output nothing |
'normal' | true | Standard output |
'verbose' | none | Output everything |
'detailed' | none | Output everything except chunkModules and chunkRootModules |
'summary' | none | Output webpack version, warnings count and errors count |
It is possible to specify which information you want to see in the stats output.
A fallback value for stats options when an option is not defined. It has precedence over local webpack defaults.
export default {
// ...
stats: {
all: undefined,
},
};boolean = true
Tells stats whether to show the asset information. Set stats.assets to false to hide it.
export default {
// ...
stats: {
assets: false,
},
};string = 'id'
Tells stats to sort the assets by a given field. All of the sorting fields are allowed to be used as values for stats.assetsSort. Use ! prefix in the value to reverse the sort order by a given field.
export default {
// ...
stats: {
assetsSort: "!size",
},
};number = 15
Tells stats how many items of assets should be displayed (groups will be collapsed to fit this space).
export default {
// ...
stats: {
assetsSpace: 15,
},
};boolean = true
Tells stats whether to add the build date and the build time information. Set stats.builtAt to false to hide it.
export default {
// ...
stats: {
builtAt: false,
},
};Old version of stats.cachedModules.
boolean = true
Tells stats whether to add 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).
export default {
// ...
stats: {
cachedAssets: false,
},
};boolean = true
Tells stats whether to add information about cached (not built) modules.
export default {
// ...
stats: {
cachedModules: false,
},
};boolean = true
Tells stats whether to add information about the children.
export default {
// ...
stats: {
children: false,
},
};boolean = true
Display auxiliary assets in chunk groups.
export default {
// ...
stats: {
chunkGroupAuxiliary: false,
},
};boolean = true
Display children of the chunk groups (e.g. prefetched, preloaded chunks and assets).
export default {
// ...
stats: {
chunkGroupChildren: false,
},
};number
Limit of assets displayed in chunk groups.
export default {
// ...
stats: {
chunkGroupMaxAssets: 5,
},
};boolean = true
Tells stats whether to add information about the namedChunkGroups.
export default {
// ...
stats: {
chunkGroups: false,
},
};boolean = true
Tells stats whether to add information about the built modules to information about the chunk.
export default {
// ...
stats: {
chunkModules: false,
},
};number = 10
Tells stats how many items of chunk modules should be displayed (groups will be collapsed to fit this space).
export default {
// ...
stats: {
chunkModulesSpace: 15,
},
};boolean = true
Tells stats whether to add information about the origins of chunks and chunk merging.
export default {
// ...
stats: {
chunkOrigins: false,
},
};boolean = false
Tells stats to display chunk parents, children and siblings.
export default {
// ...
stats: {
chunkRelations: false,
},
};boolean = true
Tells stats whether to add information about the chunk. Setting stats.chunks to false results in a less verbose output.
export default {
// ...
stats: {
chunks: false,
},
};string = 'id'
Tells stats to sort the chunks by a given field. All of the sorting fields are allowed to be used as values for stats.chunksSort. Use ! prefix in the value to reverse the sort order by a given field.
export default {
// ...
stats: {
chunksSort: "name",
},
};boolean = false { bold?: string, cyan?: string, green?: string, magenta?: string, red?: string, yellow?: string }
Tells stats whether to output in the different colors.
export default {
// ...
stats: {
colors: true,
},
};It is also available as a CLI flag:
npx webpack --stats-colorsTo disable:
npx webpack --no-stats-colorsYou can specify your own terminal output colors using ANSI escape sequences
export default {
// ...
colors: {
green: "\u001B[32m",
},
};string
The stats base directory, an absolute path for shortening the request information.
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
// ...
stats: {
context: path.resolve(__dirname, "src/components"),
},
};By default, the value of context or the Node.js current working directory is used.
boolean
Tells stats whether to show chunk modules that are dependencies of other modules of the chunk.
export default {
// ...
stats: {
dependentModules: false,
},
};boolean = false
Tells stats whether to display the distance from the entry point for each module.
export default {
// ...
stats: {
depth: true,
},
};boolean = true "auto"
Tells stats whether to display the entry points with the corresponding bundles.
export default {
// ...
stats: {
entrypoints: false,
},
};When stats.entrypoints is set to 'auto', webpack will decide automatically whether to display the entry points in the stats output.
boolean = false
Tells stats whether to display the --env information.
export default {
// ...
stats: {
env: true,
},
};boolean "auto"
Tells stats whether to include the cause property of errors in the output. It defaults to true.
export default {
// ...
stats: {
errorCause: true,
},
};boolean "auto"
Tells stats whether to add the details to the errors. It defaults to 'auto' which will show error details when there're only 2 or less errors.
export default {
// ...
stats: {
errorDetails: false,
},
};boolean "auto"
Tells stats whether to include the errors array from AggregateError instances in the output. It defaults to true.
Useful when a single error is composed of multiple underlying errors, providing deeper visibility into grouped error structures.
export default {
// ...
stats: {
errorErrors: true,
},
};boolean = true
Tells stats whether to show stack trace of errors.
export default {
// ...
stats: {
errorStack: false,
},
};boolean = true
Tells stats whether to display the errors.
export default {
// ...
stats: {
errors: false,
},
};boolean = true
Add errors count.
export default {
// ...
stats: {
errorsCount: false,
},
};number
Tells stats to limit the number of lines to allocate for displaying an error.
export default {
// ...
stats: {
errorsSpace: 5,
},
};See stats.excludeModules.
array = []: string | RegExp | function (assetName) => boolean string RegExp function (assetName) => boolean
Tells stats to 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.
export default {
// ...
stats: {
excludeAssets: [
"filter",
/filter/,
(assetName) => assetName.contains("moduleA"),
],
},
};array = []: string | RegExp | function (assetName) => boolean string RegExp function (assetName) => boolean boolean: false
Tells stats to exclude the matching modules information. This can be done with a string, a RegExp, a function that is getting the module's source as an argument and returns a boolean. stats.excludeModules can be an array of any of the above. stats.excludeModules's configuration is merged with the stats.exclude's configuration value.
export default {
// ...
stats: {
excludeModules: ["filter", /filter/, (moduleSource) => true],
},
};Setting stats.excludeModules to false will disable the exclude behaviour.
export default {
// ...
stats: {
excludeModules: false,
},
};boolean
Tells stats whether to group assets by how their are related to chunks.
export default {
// ...
stats: {
groupAssetsByChunk: false,
},
};boolean
Tells stats whether to group assets by their status (emitted, compared for emit or cached).
export default {
// ...
stats: {
groupAssetsByEmitStatus: false,
},
};boolean
Tells stats whether to group assets by their extension.
export default {
// ...
stats: {
groupAssetsByExtension: false,
},
};boolean
Tells stats whether to group assets by their asset info (immutable, development, hotModuleReplacement, etc).
export default {
// ...
stats: {
groupAssetsByInfo: false,
},
};boolean
Tells stats whether to group assets by their asset path.
export default {
// ...
stats: {
groupAssetsByPath: false,
},
};boolean
Tells stats whether to group modules by their attributes (errors, warnings, assets, optional, orphan, or dependent).
export default {
// ...
stats: {
groupModulesByAttributes: false,
},
};boolean
Tells stats whether to group modules by their cache status (cached or built and cacheable).
export default {
// ...
stats: {
groupModulesByCacheStatus: true,
},
};boolean
Tells stats whether to group modules by their extension.
export default {
// ...
stats: {
groupModulesByExtension: true,
},
};boolean
Tells stats whether to group modules by their layer.
export default {
// ...
stats: {
groupModulesByLayer: true,
},
};boolean
Tells stats whether to group modules by their path.
export default {
// ...
stats: {
groupModulesByPath: true,
},
};boolean
Tells stats whether to group modules by their type.
export default {
// ...
stats: {
groupModulesByType: true,
},
};boolean
Group reasons by their origin module to avoid large set of reasons.
export default {
// ...
stats: {
groupReasonsByOrigin: true,
},
};boolean = true
Tells stats whether to add information about the hash of the compilation.
export default {
// ...
stats: {
hash: false,
},
};boolean = false
Tells stats to add IDs of modules and chunks.
export default {
// ...
stats: {
ids: true,
},
};string = 'info': 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose' boolean
Tells stats 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.export default {
// ...
stats: {
logging: "verbose",
},
};array = []: string | RegExp | function (name) => boolean string RegExp function (name) => boolean
Tells stats to include the debug information of the specified loggers such as Plugins or Loaders. When stats.logging is set to false, stats.loggingDebug option is ignored.
export default {
// ...
stats: {
loggingDebug: [
"MyPlugin",
/MyPlugin/,
/webpack/, // To get core logging
(name) => name.contains("MyPlugin"),
],
},
};boolean = true
Enable stack traces in the logging output for errors, warnings and traces. Set stats.loggingTrace to hide the trace.
export default {
// ...
stats: {
loggingTrace: false,
},
};boolean = true
Tells stats whether to add information about assets inside modules. Set stats.moduleAssets to false to hide it.
export default {
// ...
stats: {
moduleAssets: false,
},
};boolean = true
Tells stats to show dependencies and the origin of warnings/errors. stats.moduleTrace is available since webpack 2.5.0.
export default {
// ...
stats: {
moduleTrace: false,
},
};boolean = true
Tells stats whether to add information about the built modules.
export default {
// ...
stats: {
modules: false,
},
};string = 'id'
Tells stats to sort the modules by a given field. All of the sorting fields are allowed to be used as values for stats.modulesSort. Use ! prefix in the value to reverse the sort order by a given field.
export default {
// ...
stats: {
modulesSort: "size",
},
};number = 15
Tells stats how many items of modules should be displayed (groups will be collapsed to fit this space).
export default {
// ...
stats: {
modulesSpace: 15,
},
};boolean
Tells stats whether to add information about modules nested in other modules (like with module concatenation).
export default {
// ...
stats: {
nestedModules: true,
},
};number = 10
Tells stats how many items of nested modules should be displayed (groups will be collapsed to fit this space).
export default {
// ...
stats: {
nestedModulesSpace: 15,
},
};boolean
Tells stats to show the reasons why optimization bailed out for modules.
export default {
// ...
stats: {
optimizationBailout: false,
},
};boolean = false
Tells stats whether to hide orphan modules. A module is an orphan if it is not included in any chunk. Orphan modules are hidden by default in stats.
export default {
// ...
stats: {
orphanModules: true,
},
};boolean = true
Tells stats to show the outputPath.
export default {
// ...
stats: {
outputPath: false,
},
};boolean = true
Tells stats to show performance hint when the file size exceeds performance.maxAssetSize.
export default {
// ...
stats: {
performance: false,
},
};string boolean: false
Sets the preset for the type of information that gets displayed. It is useful for extending stats behaviours.
export default {
// ...
stats: {
preset: "minimal",
},
};Setting value of stats.preset to false tells webpack to use 'none' stats preset.
boolean = false
Tells stats to show the exports of the modules.
export default {
// ...
stats: {
providedExports: true,
},
};boolean = true
Tells stats to show the publicPath.
export default {
// ...
stats: {
publicPath: false,
},
};boolean = true
Tells stats to add information about the reasons of why modules are included.
export default {
// ...
stats: {
reasons: false,
},
};number
Space to display reasons (groups will be collapsed to fit this space).
export default {
// ...
stats: {
reasonsSpace: 1000,
},
};boolean = false
Tells stats whether to add information about assets that are related to other assets (like SourceMaps for assets).
export default {
// ...
stats: {
relatedAssets: true,
},
};boolean = true
Tells stats whether to add information about runtime modules.
export default {
// ...
stats: {
runtimeModules: false,
},
};boolean = false
Tells stats to add the source code of modules.
export default {
// ...
stats: {
source: true,
},
};boolean = true
Tells stats to add the timing information.
export default {
// ...
stats: {
timings: false,
},
};boolean = false
Tells stats whether to show which exports of a module are used.
export default {
// ...
stats: {
usedExports: true,
},
};boolean = true
Tells stats to add information about the webpack version used.
export default {
// ...
stats: {
version: false,
},
};boolean = true
Tells stats to add warnings.
export default {
// ...
stats: {
warnings: false,
},
};boolean = true
Add warnings count.
export default {
// ...
stats: {
warningsCount: false,
},
};array = []: string | RegExp | function (warning) => boolean string RegExp function (warning) => boolean
Tells stats to exclude the warnings that are matching given filters. This can be done with a string, a RegExp, a function that is getting a warning as an argument and returns a boolean. stats.warningsFilter can be an array of any of the above.
export default {
// ...
stats: {
warningsFilter: ["filter", /filter/, (warning) => true],
},
};number
Tells stats to limit the number of lines to allocate for displaying a warning.
export default {
// ...
stats: {
warningsSpace: 5,
},
};For assetsSort, chunksSort, and modulesSort there are several possible fields that you can sort items by:
'id' - the item's id,'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 asset has been built,'prefetched' - whether the asset will be prefetched,'optional' - whether the asset is optional.'identifier' - identifier of the item.'index' - item's processing index.'index2''profile''issuer' - an identifier of the issuer.'issuerId' - an id of the issuer.'issuerName' - a name of the issuer.'issuerPath' - a full issuer object. There's no real need to sort by this field.If you want to use one of the presets e.g. 'minimal' but still override some of the rules: specify the desired stats.preset and add the customized or additional rules afterwards.
webpack.config.js
export default {
// ..
stats: {
preset: "minimal",
moduleTrace: true,
errorDetails: true,
},
};