{"record":{"id":"90379f27ae974df3","repo":"angular/angular-cli","slug":"invalid-webpack-stats-configuration","errorCode":null,"errorMessage":"Invalid Webpack stats configuration.","messagePattern":"Invalid Webpack stats configuration\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/tools/webpack/utils/stats.ts","lineNumber":357,"sourceCode":"    initialChunksCount,\n    changedChunksCount,\n    durationInMs: getBuildDuration(webpackStats),\n    cssSizeInBytes,\n    jsSizeInBytes,\n    ngComponentCount,\n  };\n}\n\nexport function webpackStatsLogger(\n  logger: logging.LoggerApi,\n  json: StatsCompilation,\n  config: Configuration,\n  budgetFailures?: BudgetCalculatorResult[],\n): void {\n  logger.info(statsToString(json, config.stats, budgetFailures));\n\n  if (typeof config.stats !== 'object') {\n    throw new Error('Invalid Webpack stats configuration.');\n  }\n\n  if (statsHasWarnings(json)) {\n    logger.warn(statsWarningsToString(json, config.stats));\n  }\n\n  if (statsHasErrors(json)) {\n    logger.error(statsErrorsToString(json, config.stats));\n  }\n}\n","sourceCodeStart":339,"sourceCodeEnd":368,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/tools/webpack/utils/stats.ts#L339-L368","documentation":"webpackStatsLogger prints formatted build stats. It requires config.stats to be an options object so it can compute which fields to print. If stats is a string preset (like 'minimal' or 'errors-only') or otherwise not an object, the formatter can't proceed and throws.","triggerScenarios":"Calling webpackStatsLogger with a webpack Configuration whose `stats` field is a string preset or undefined/non-object — typically from custom webpack builder configs passing `stats: 'minimal'` or similar.","commonSituations":"Custom webpack configs copied from generic webpack examples where string stats presets are common; programmatic use of the browser/webpack builder with hand-built Configuration objects.","solutions":["Set `stats` in your webpack config to an object (e.g. { all: false, errors: true, warnings: true }).","Remove custom `stats` overrides so the CLI's default stats object is used.","If using a custom builder, pass a resolved stats object into webpackStatsLogger instead of a string.","Check for plugins that rewrite config.stats to a string preset and disable them."],"exampleFix":"// before\nmodule.exports = { stats: 'minimal' };\n// after\nmodule.exports = { stats: { all: false, errors: true, warnings: true, assets: true } };","handlingStrategy":"type-guard","validationCode":"if (typeof config.stats !== 'object' || config.stats === null) {\n  throw new TypeError('webpack config.stats must be an options object for webpackStatsLogger');\n}","typeGuard":"function isStatsObject(stats: Configuration['stats']): stats is StatsOptions {\n  return typeof stats === 'object' && stats !== null && !Array.isArray(stats);\n}","tryCatchPattern":"try {\n  webpackStatsLogger(logger, stats, config);\n} catch (err) {\n  if (err.message === 'Invalid Webpack stats configuration.') {\n    logger.warn('stats was not an object; defaulting to verbose stats');\n  } else throw err;\n}","preventionTips":["Never use string stats presets ('minimal','errors-only') with angular builders.","Let the CLI set its own stats config unless you know the expected object shape.","Watch for plugins that overwrite config.stats.","Coerce preset strings to objects before passing Configuration to builders."],"tags":["webpack","stats","configuration"],"backgroundTag":"invalid-config-type","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}