angular/angular-cli · warning

The "publicHost" option will not be used because it is not s

Error message

The "publicHost" option will not be used because it is not supported by the "${builderName}" builder.

What it means

When the resolved dev-server builder is an esbuild/Vite-based builder ('application' or 'browser-esbuild'), the 'publicHost' option is not supported; the builder warns that it will be ignored. The dev server starts, but the public host override has no effect.

Source

Thrown at packages/angular_devkit/build_angular/src/builders/dev-server/builder.ts:82

  return defer(() => initialize(options, projectName, context, extensions?.builderSelector)).pipe(
    switchMap(({ builderName, normalizedOptions }) => {
      // Use vite-based development server for esbuild-based builds
      if (isEsbuildBased(builderName)) {
        if (transforms?.logging || transforms?.webpackConfiguration) {
          throw new Error(
            `The "application" and "browser-esbuild" builders do not support Webpack transforms.`,
          );
        }

        if (options.publicHost) {
          context.logger.warn(
            `The "publicHost" option will not be used because it is not supported by the "${builderName}" builder.`,
          );
        }

        if (options.disableHostCheck) {
          context.logger.warn(
            `The "disableHostCheck" option will not be used because it is not supported by the "${builderName}" builder.`,
          );
        }

        // New build system defaults hmr option to the value of liveReload
        normalizedOptions.hmr ??= normalizedOptions.liveReload;

        // New build system uses Vite's allowedHost option convention of true for disabling host checks
        if (normalizedOptions.disableHostCheck) {
          (normalizedOptions as unknown as { allowedHosts: true }).allowedHosts = true;
        } else {
          normalizedOptions.allowedHosts ??= [];
        }

        return defer(() =>
          Promise.all([import('@angular/build/private'), import('../browser-esbuild')]),
        ).pipe(
          switchMap(([{ serveWithVite, buildApplicationInternal }, { convertBrowserOptions }]) =>

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Remove `publicHost` from the serve target options.
  2. If you need the option, use the Webpack-based dev-server builder (acknowledging its deprecation).
  3. Use the '@angular/build:dev-server' equivalent mechanisms (allowedHosts/disableHostCheck equivalents via Vite server config) where applicable.

Example fix

// before
"options": { "publicHost": "myapp.local" }
// after
"options": {}
Defensive patterns

Strategy: validation

Validate before calling

if (usingEsbuildDevServer && target.options?.publicHost) {
  delete target.options.publicHost; // ignored by esbuild-based builders
}

Type guard

function setsPublicHost(o: unknown): o is { publicHost: string } {
  return typeof o === 'object' && o !== null && typeof (o as any).publicHost === 'string';
}

Prevention

When it happens

Trigger: Running the dev-server builder resolved to an esbuild-based builder with `publicHost` set (e.g. for Docker/container or reverse-proxy setups).

Common situations: Serving inside containers/CI behind a proxy where publicHost was configured for the Webpack dev server; migrating to Vite-based serving and observing host/proxy behavior changes.

Related errors


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