Material-components-web: [mdc-select/mdc-list] Broken SASS compilation after V5

Created on 19 Feb 2020  路  2Comments  路  Source: material-components/material-components-web

In my components SASS file I import these:

@import '@material/list/mdc-list';
@import '@material/menu-surface/mdc-menu-surface';
@import '@material/menu/mdc-menu';
@import '@material/select/mdc-select';

it used to work, but now with v5 I'm getting this error:

{
  "status": 1,
  "file": "../../node_modules/@material/list/mdc-list.scss",
  "line": 22,
  "column": 10,
  "message": "Invalid CSS after \"@include mixins\": expected 1 selector or at-rule, was \".core-styles;\"",
  "formatted": "Error: Invalid CSS after \"@include mixins\": expected 1 selector or at-rule, was \".core-styles;\"\n        on line 22 of ../../node_modules/@material/list/mdc-list.scss\n        from line 1 of src/sass/drop-down.scss\n>> @include mixins.core-styles;\n\n   ---------^\n"
}

I'm using the latest version of node-sass.

bug

Most helpful comment

@raphaelsantos node-sass doesn't support @use sass modules yet... If you switch to the dart implementation by installing the sass package (should be interchangeable API-wise) then it will work. The only issue with this is that the compilation is a lot slower on large libraries, and it forces consuming applications of our own sass libraries (that take a dependency on MDC) to also use dart sass.

All 2 comments

@raphaelsantos node-sass doesn't support @use sass modules yet... If you switch to the dart implementation by installing the sass package (should be interchangeable API-wise) then it will work. The only issue with this is that the compilation is a lot slower on large libraries, and it forces consuming applications of our own sass libraries (that take a dependency on MDC) to also use dart sass.

Closing since MDC switched to Sass modules in v5, so this is working as intended. The recommendation for client libraries that consume MDC is to use Dart sass for compilation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhiomkar picture abhiomkar  路  3Comments

AbuMareBear picture AbuMareBear  路  3Comments

patrickrodee picture patrickrodee  路  3Comments

trimox picture trimox  路  4Comments

robzenn92 picture robzenn92  路  4Comments