Skip to content

bug: warning about missing core theme when using prebuilt M3-theme in v18 #29129

@SebastianKohler

Description

@SebastianKohler

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using the prebuilt "azure-blue" M3-based theme (@angular/material/prebuilt-themes/azure-blue.css) I get a warning in the browser console:

Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming main.ts:5

Despite of the warning, the Material components seem to work as they should, I haven't tested them all though.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-wu4fpp?file=src%2Fapp%2Fapp.component.html
Steps to reproduce:

  1. Create a new Angular 18 app (without SSR)
  2. Add Angular Material 18 and select the azure-blue M3-based prebuilt theme.
  3. Add a Material component, for example a button, to app.component.
  4. Serve and watch the browser console for the warning (open preview in new tab in Stackblitz and open console in DevTools).

Expected Behavior

No warning in the console.

Actual Behavior

The above mentioned warning in the browser console.

Environment

Angular CLI: 18.0.1
Node: 20.12.1
Package Manager: npm 10.5.0
OS: win32 x64

Angular: 18.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, platform-browser, platform-browser-dynamic, router

Package Version
@angular-devkit/architect 0.1800.1
@angular-devkit/build-angular 18.0.1
@angular-devkit/core 18.0.1
@angular-devkit/schematics 18.0.1
@angular/cli 18.0.1
@schematics/angular 18.0.1
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions