material-components-web: [Webpack] Invalid CSS after "@include mixins"
Bug report
Hello, I try to pack mdc with Webpack and Typscript.
In Version 4.0.0 I get this error:
ERROR in [at-loader] ./node_modules/@material/auto-init/index.d.ts:38:16
TS2528: A module cannot have multiple default exports.
This is fixed by Version: “^5.0.0-canary.faa9af310.0” But now I have the error:
ERROR in ./src/frontend/sass/main.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Invalid CSS after "@include mixins": expected 1 selector or at-rule, was ".core-styles;"
on line 24 of node_modules/@material/button/mdc-button.scss
Steps to reproduce
1 Create a Example Project like this. https://github.com/material-components/material-components-web/blob/master/docs/getting-started.md 2. update mdc: npm i material-components-web@5.0.0-canary.faa9af310.0 3. run npm: npm start
Your Environment:
| Software | Version(s) |
|---|---|
| MDC Web | 5.0.0-canary.faa9af310.0 |
| Browser | chrome |
| Operating System | Debian 10 |
Possible solution
The only way to fix both problems, go to version 2.3.1.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 21 (6 by maintainers)
I was getting
and fixed it by removing
node-sassand installingsass@1.25.0.I created full working example with some of the popular bundlers: Webpack, Rollup & Snowpack.
CSS modules require
sass@^1.23.0. Make sure you’re on that version or later to use them.If you’re using
sass-loaderit will automatically usesass, but you’ll need to make sure any traces ofnode-sasshave been fully removed from the project.If you’re continuing to have problems, create a reproduction repository with your package.json and package-lock.json.
Hi @abraham
I get this error
Hi, MDC Web is not officially supported on Canary. We recommend using the
@latestrelease.… from my part it was not a support request - as I don’t expect you to “support”. However the feedback that is delivered here could potentially help improve the library and help the community too… @latest is currently 3 months behind (and projects using the mdc libraries are often not able to wait for 3 month for updates and improvements). Using canary at least give some interim fixes as well as avoid having major breaking changes hit you. As @canary releases are available on npm I think it is not unreasonable that some (including myself) have used “the latest” build before asking further questions or requesting new features. But in any case thanks for the feedback.
here is temporary solution: https://github.com/webpack-contrib/sass-loader/issues/804#issuecomment-586095020