angular/angular-cli · warning

Warning: 'outputHashing' option is disabled when using the d

Error message

Warning: 'outputHashing' option is disabled when using the dev-server.

What it means

When the browser build target specifies `outputHashing` other than `none`, the webpack dev-server forcibly resets it to `none` and warns. Output hashing is disabled for dev builds because hashed filenames accumulating in memory can cause memory leaks in webpack-dev-server. The warning tells you your configured option was overridden.

Source

Thrown at packages/angular_devkit/build_angular/src/builders/dev-server/webpack-server.ts:96

  assertCompatibleAngularVersion(workspaceRoot);

  async function setup(): Promise<{
    browserOptions: BrowserBuilderSchema;
    webpackConfig: webpack.Configuration;
  }> {
    if (options.hmr) {
      logger.warn(tags.stripIndents`NOTICE: Hot Module Replacement (HMR) is enabled for the dev server.
      See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`);
    }

    // Get the browser configuration from the target name.
    const rawBrowserOptions = await context.getTargetOptions(options.buildTarget);

    if (rawBrowserOptions.outputHashing && rawBrowserOptions.outputHashing !== OutputHashing.None) {
      // Disable output hashing for dev build as this can cause memory leaks
      // See: https://github.com/webpack/webpack-dev-server/issues/377#issuecomment-241258405
      rawBrowserOptions.outputHashing = OutputHashing.None;
      logger.warn(`Warning: 'outputHashing' option is disabled when using the dev-server.`);
    }

    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
    const browserOptions = (await context.validateOptions(
      {
        ...rawBrowserOptions,
        watch: options.watch,
        verbose: options.verbose,
        // In dev server we should not have budgets because of extra libs such as socks-js
        budgets: undefined,
      } as json.JsonObject & BrowserBuilderSchema,
      builderName,
    )) as json.JsonObject & BrowserBuilderSchema;

    const { styles, scripts } = normalizeOptimization(browserOptions.optimization);
    if (scripts || styles.minify) {
      logger.error(tags.stripIndents`
        ****************************************************************************************

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Serve with a development configuration that does not set outputHashing (or sets it to "none")
  2. If you need prod-like behavior, run `ng build` instead of serve for hashed outputs
  3. Override outputHashing in a serve-specific configuration: `"configurations": { "production-serve": { "outputHashing": "none" } }`
  4. Ignore the warning if the override is acceptable; the build still works

Example fix

// before
ng serve --configuration production
// after (angular.json)
"configurations": { "prod-serve": { "outputHashing": "none" } }
// ng serve --configuration prod-serve
Defensive patterns

Strategy: validation

Validate before calling

// detect outputHashing in the serve buildTarget before ng serve
const buildOpts = getTargetOptions(serveOptions.buildTarget);
if (buildOpts.outputHashing && buildOpts.outputHashing !== 'none') {
  console.warn('outputHashing will be disabled by the dev-server; remove it or serve with a dev configuration.');
}

Type guard

function hashesWillBeDisabled(o: { outputHashing?: 'none'|'media'|'bundles'|'all' }): boolean {
  return !!o?.outputHashing && o.outputHashing !== 'none';
}

Prevention

When it happens

Trigger: `ng serve` where the buildTarget (e.g. the browser build configuration) sets `"outputHashing": "all"` (or media/bundles); also happens when serving with the production configuration, which defaults outputHashing to all.

Common situations: Running `ng serve -c production` to debug prod-like behavior, or a shared configuration block that applies outputHashing to both build and serve targets.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/345692a2790c6065. Report an issue: GitHub.