-
Notifications
You must be signed in to change notification settings - Fork 85
SassError: Can't find stylesheet to import #2120
Description
Describe the bug
I'm not sure this is specifically an MDC Web bug, but I'm open to suggestions or workarounds.
Loading the styles for Chips does not appear to be usable, due to @material/chips using a @forward directive, which is not supported by the current Sass pulled in by the Angular toolkit.
To Reproduce
Steps to reproduce the behavior:
- Generate a new Angular 9 project and include angular-mdc/web as per the Getting Started page
- Include the modules and styles for Chips as outlined on this page. Namely:
@use '@material/chips/mdc-chips';
@use '@material/chips';- Run
ng serve
It will produce this error:
ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--15-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
╷
4 │ @use "@material/chips";
│ ^^^^^^^^^^^^^^^^^^^^^^
╵
C:\Users\IGEN261\code\test\styletests\c\src\styles.scss 4:1 root stylesheet
What Angular MDC version are you using?
- Angular 9.0.2
- Angular MDC Web 5.0.4
What OS are you using?: Windows 10
What browser(s) is this bug affecting?: n/a
Additional context
I think what's happening is that while @material/chips/_index.scss exists, it's using a @forward directive to include its mixins and variables: https://github.com/material-components/material-components-web/blob/master/packages/mdc-chips/_index.scss
This was a new at-rule to me, but based on this documentation, I believe it's only available in a future version of dart-sass (1.24.0, while the Angular CLI loads 1.23.3).
I'm not sure how to resolve this. Are there any workarounds or other approaches you might recommend?