angular/angular-cli · warning

*

Error message

*

What it means

The ivy extraction webpack loader wraps the localization logger: info() and warn() calls from @angular/localize's extraction are routed to webpack's emitWarning as Error objects, and error() to emitError. This surfaces internal extraction diagnostics as webpack warnings in the build output.

Source

Thrown at packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts:69

    MessageExtractor = MsgExtractor;
  } catch {
    throw new Error(
      `Unable to load message extractor. Please ensure '@angular/localize' is installed.`,
    );
  }

  // Setup a Webpack-based logger instance
  const logger = {
    // level 2 is warnings
    level: 2,
    debug(...args: string[]): void {
      // eslint-disable-next-line no-console
      console.debug(...args);
    },
    info(...args: string[]): void {
      loaderContext.emitWarning(new Error(args.join('')));
    },
    warn(...args: string[]): void {
      loaderContext.emitWarning(new Error(args.join('')));
    },
    error(...args: string[]): void {
      loaderContext.emitError(new Error(args.join('')));
    },
  };

  let filename = loaderContext.resourcePath;
  const mapObject =
    typeof map === 'string' ? (JSON.parse(map) as Exclude<LoaderSourceMap, string>) : map;
  if (mapObject?.file) {
    // The extractor's internal sourcemap handling expects the filenames to match
    filename = nodePath.join(loaderContext.context, mapObject.file);
  }

  // Setup a virtual file system instance for the extractor
  // * MessageExtractor itself uses readFile, relative and resolve
  // * Internal SourceFileLoader (sourcemap support) uses dirname, exists, readFile, and resolve

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Read the warning text after 'Error:' to see the actual extraction diagnostic and fix the underlying i18n source issue.
  2. Check templates' i18n attributes and tsconfig compilerOptions for misconfiguration flagged by the extractor.
  3. Upgrade @angular/localize and @angular-devkit/build-angular to aligned versions to reduce spurious extraction warnings.
Defensive patterns

Strategy: validation

Validate before calling

// Keep localize/build packages version-aligned:
const pkg = require('./package.json');
const v = pkg.dependencies['@angular/core'];
if (!pkg.dependencies['@angular/localize']?.startsWith(v.split('.').slice(0,2).join('.'))) console.warn('Version mismatch: @angular/localize vs @angular/core');

Prevention

When it happens

Trigger: Running extract-i18n with the ivy loader when @angular/localize's extractor logs an info or warning message during message extraction (e.g., schema issues, malformed i18n metadata).

Common situations: Extraction warnings from the Angular compiler/localize tooling appear as webpack 'Error:' warnings; developers are confused seeing non-fatal messages as warnings.

Related errors


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