To fix the error "Can't find stylesheet to import." when importing Angular Material theming in styles.scss, you need to switch from @import to the new Sass module system using @use.
@use '@angular/material' as mat;
$my-primary: mat.define-palette(mat.$indigo-palette, 500);
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$my-warn: mat.define-palette(mat.$red-palette);
$my-theme: mat.define-light-theme((
color: (
primary: $my-primary,
accent: $my-accent,
warn: $my-warn,
),
typography: mat.define-typography-config(),
density: 0,
));
// Include the theme styles
@include mat.all-component-themes($my-theme);
See the docs: 👉 https://v17.material.angular.io/guide/theming