angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Can't find stylesheet to import. @import "@angular/material/theming";

Open RichardBoyder opened this issue 2 years ago • 3 comments

Command

serve

Is this a regression?

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

The previous version in which this bug was not present was

No response

Description

I know this has been opened and closed before but for current Material Version "^17.0.5" I get the issue in the title:

Can't find stylesheet to import. ╷ 6 │ @import "@angular/material/theming"; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ src/styles.scss 6:9 root stylesheet

However I didnt see a fix for it and the issue was closed automatically.

Please help?

Minimal Reproduction

Updated to latest angular 17 Tried to run ng serve

"dependencies": { "@angular/animations": "^17.0.9", "@angular/cdk": "^17.0.5", "@angular/common": "^17.0.9", "@angular/compiler": "^17.0.9", "@angular/core": "^17.0.9", "@angular/forms": "^17.0.9", "@angular/material": "^17.0.5", "@angular/material-moment-adapter": "^17.0.5", "@angular/platform-browser": "^17.0.9", "@angular/platform-browser-dynamic": "^17.0.9", "@angular/router": "^17.0.9", "@popperjs/core": "^2.11.6", "apexcharts": "^3.44.0", "@ng-bootstrap/ng-bootstrap":"16.0.0", "bootstrap": "^5.3.2", "moment": "^2.18.1", "ng-apexcharts": "^1.8.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.14.3" },

Exception or Error

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Can't find stylesheet to import.
  ╷
6 │ @import "@angular/material/theming";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/styles.scss 6:9  root stylesheet

Your Environment

@angular-devkit/architect          0.1700.10
@angular-devkit/build-angular      17.0.10
@angular-devkit/core               17.0.10
@angular-devkit/schematics         17.0.10
@angular/cdk                       17.0.5
@angular/cli                       17.0.10
@angular/material                  17.0.5
@angular/material-moment-adapter   17.0.5
@schematics/angular                17.0.10
rxjs                               7.8.1
typescript                         5.2.2
zone.js                            0.14.3

Anything else relevant?

No response

RichardBoyder avatar Jan 15 '24 14:01 RichardBoyder

Ok so it seems in angular material 17.... perhaps that file is no longer needed. I'll wait to see if any responses come here... to validate this. I just removed the reference to //@import "@angular/material/theming";

And it builds and things seem ok

RichardBoyder avatar Jan 15 '24 15:01 RichardBoyder

Please see angular/components#28286, angular/components#28204, angular/components#28309, per the breaking changes note in Material 17.0:

@import of Angular Material and Angular CDK Sass is no longer supported. Please use @use instead. Source

JoostK avatar Jan 15 '24 16:01 JoostK

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.