{"record":{"id":"682bc675f567012c","repo":"angular/angular-cli","slug":"webpack-stats-build-result-is-required","errorCode":null,"errorMessage":"Webpack stats build result is required.","messagePattern":"Webpack stats build result is required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/browser/index.ts","lineNumber":193,"sourceCode":"          transforms.logging ||\n          ((stats, config) => {\n            if (options.verbose && config.stats !== false) {\n              const statsOptions = config.stats === true ? undefined : config.stats;\n              context.logger.info(stats.toString(statsOptions));\n            }\n          }),\n      }).pipe(\n        concatMap(\n          async (\n            buildEvent,\n          ): Promise<{ output: BuilderOutput; webpackStats: StatsCompilation }> => {\n            const spinner = new Spinner();\n            spinner.enabled = options.progress !== false;\n\n            const { success, emittedFiles = [], outputPath: webpackOutputPath } = buildEvent;\n            const webpackRawStats = buildEvent.webpackStats;\n            if (!webpackRawStats) {\n              throw new Error('Webpack stats build result is required.');\n            }\n\n            // Fix incorrectly set `initial` value on chunks.\n            const extraEntryPoints = [\n              ...normalizeExtraEntryPoints(options.styles || [], 'styles'),\n              ...normalizeExtraEntryPoints(options.scripts || [], 'scripts'),\n            ];\n\n            const webpackStats = {\n              ...webpackRawStats,\n              chunks: markAsyncChunksNonInitial(webpackRawStats, extraEntryPoints),\n            };\n\n            if (!success) {\n              // If using bundle downleveling then there is only one build\n              // If it fails show any diagnostic messages and bail\n              if (statsHasWarnings(webpackStats)) {\n                context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/browser/index.ts#L175-L211","documentation":"The browser builder's webpack completion event must carry webpackStats, which the builder uses to compute emitted files, budgets, index generation, and the final BrowserBuilderOutput. If the build event arrives without stats (undefined), the builder refuses to continue because downstream processing would crash or produce wrong output.","triggerScenarios":"A custom webpack configuration transformation strips or fails to attach webpackStats to the compilation/build event; using transforms.webpackConfiguration that returns a config incompatible with stats generation; webpack plugin versions whose BuildEvent no longer populates webpackStats; intercepting the build observable and re-emitting events without stats.","commonSituations":"Custom Angular CLI plugins/scripts that pipe the build observable; third-party builders wrapping the browser builder and forwarding malformed build events; upgrading @angular-devkit/build-angular while keeping custom transforms that assume an older event shape.","solutions":["Remove or fix any webpackConfiguration/logging transforms that mutate the build pipeline and drop stats.","If wrapping the builder, forward the original buildEvent (with webpackStats) rather than a reconstructed object.","Update @angular-devkit/build-angular to latest and verify custom plugins match its BuildEvent interface.","Run a plain build without custom config to confirm stock webpack emits stats; bisect from there."],"exampleFix":"// before\nreturn build.pipe(map(ev => ({ success: ev.success }))); // drops webpackStats\n// after\nreturn build; // forward full build event including webpackStats","handlingStrategy":"type-guard","validationCode":"import type { BuildEvent } from '@angular-devkit/build-angular';\nfunction hasStats(ev: Partial<BuildEvent>): ev is BuildEvent & { webpackStats: NonNullable<BuildEvent['webpackStats']> } {\n  return !!ev.webpackStats;\n}","typeGuard":"const hasWebpackStats = (ev: { webpackStats?: unknown }): ev is { webpackStats: NonNullable<typeof ev.webpackStats> } =>\n  ev.webpackStats != null;","tryCatchPattern":"try {\n  await ngBuild();\n} catch (e) {\n  if (String(e.message).includes('Webpack stats build result is required')) {\n    // stop forwarding modified build events; forward the original event\n  }\n  throw e;\n}","preventionTips":["Do not pipe/map the build observable into reconstructed events","Keep transforms minimal and stats-preserving","Pin compatible @angular-devkit/build-angular versions","Test custom wrappers against stock builds"],"tags":["angular","webpack","build","stats"],"backgroundTag":"webpack-stats-missing","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}