material-components-web-codelabs icon indicating copy to clipboard operation
material-components-web-codelabs copied to clipboard

@forward "@material/animation" as mdc-animation-*; Can't find stylesheet to import.[codelab] <PLACE YOUR ISSUE TITLE HERE>

Open melspence opened this issue 4 years ago • 14 comments

Hi, the mdc-103 project fails to compile when it hits @import "@material/ripple/mixins"

melspence avatar May 05 '20 22:05 melspence

I have a similar issue... Does anyone have any advice how to fix this?

ERROR in ./home.scss
    Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
    
    @forward "@material/animation" as mdc-animation-*;
    ^
          Can't find stylesheet to import.
      ╷
    1 │ @forward "@material/animation" as mdc-animation-*;
      │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ╵
      node_modules/@material/ripple/_mixins.import.scss 1:1  @import
      stdin 5:9                                              root stylesheet
          in /Users/robertgodino/Documents/GitHub/material-components-web-codelabs/mdc-101/starter/node_modules/@material/ripple/_mixins.import.scss (line 1, column 1)

robgoddes avatar May 20 '20 10:05 robgoddes

Faced the same issue with a error logged webpack: Failed to compile. after running npm start:

ERROR in ./home.scss
    Module build failed:
    @forward "@material/animation" as mdc-animation-*;
    ^
          Can't find stylesheet to import.
      ╷
    1 │ @forward "@material/animation" as mdc-animation-*;
      │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ╵
      node_modules/@material/ripple/_mixins.import.scss 1:1 

I installed the latest versions of packages (according to MDC Web Getting Started guide) then followed the workaround in this comment

Ultimately I changed the file paths for lines 1 - 4 at ./node_modules/@material/ripple/_mixins.import.scss to the following:

@forward "@material/animation/_index.scss" as mdc-animation-*;
@forward "@material/base/_index.scss" as mdc-base-*;
@forward "@material/feature-targeting/_index.scss" as mdc-feature-*;
@forward "@material/theme/_index.scss" as mdc-theme-*

that helped temporarily compile webpack and resolve the issue for my use of the MDC-103 course.

matthewgalang avatar May 22 '20 19:05 matthewgalang

That worked Matthew, thank you. So, I’m assuming this is a bug with the MDC Ripple Component? It’s a great quick fix BUT every time I re-install the project (e.g. to a new server for instance), I would need to manually edit that file. Would you agree that the ripple component woudl be better served by a bug fix?

robgoddes avatar May 24 '20 00:05 robgoddes

Sorry Matthew, I wasn’t very clear. What I meant to say is that when sharing an app, one can usually share it without the "node_modules" folder. Re-installing the app then recreates that "node_modules" folder which, in turn, overwrites the changes you suggested. So I would need to keep a log of my changes and edit that file every time?

robgoddes avatar May 24 '20 00:05 robgoddes

@robgoddes Glad my workaround helped you. However I'm unable to determine which party - MDC-103 Codelab Authors or MDC Developers - could be held responsible. Ultimately, since the codelab requires using the MDC Ripple package to complete the course it's hard to say whether the issue can be fixed in the codelab app or a bug fix with MDC Ripple package.

Obviously if one were to find error with @import "@material/ripple/mixins"; outside the codelabs app, I would agree that the bug fix on the MDC Ripple Package should resolve all of the above.

Unfortunately sharing an app without overwriting the workaround might require some modifications in version control though I have no experience with doing so with the node_modules folder. I hope for further use of the workaround to only assist with the completion of the course.

matthewgalang avatar May 24 '20 18:05 matthewgalang

I solved it by changing @import "@material/ripple/mixins"; to @import "@material/ripple/mdc-ripple";

arief135 avatar Jul 23 '20 15:07 arief135

@arief135 Worked like a charm! Thanks!

johnmoroney avatar Jul 23 '20 21:07 johnmoroney

I solved it by changing @import "@material/ripple/mixins"; to @import "@material/ripple/mdc-ripple";

Great!! work to me. thanks!!!

KassioRF avatar Nov 01 '20 05:11 KassioRF

@arief135 your solution worked for me too, thanks!

slackbeard avatar Nov 20 '20 07:11 slackbeard

Thanks for the help!!!

Yifei-G avatar Nov 20 '20 12:11 Yifei-G

that actually worked

juneX05 avatar Dec 10 '20 22:12 juneX05

I solved it by changing @import "@material/ripple/mixins"; to @import "@material/ripple/mdc-ripple";

Hi, thanks for the tip. Why does it work?

klgsnd avatar Mar 26 '21 10:03 klgsnd

@import "@material/ripple/mdc-ripple";

Thanks for the help.

tobinguyenn avatar Apr 07 '21 09:04 tobinguyenn

brilliant, change mixins to @import "@material/ripple/mdc-ripple"; beauty of it all, damn i get so much hope on my 3rd tutorial !

equatorlounge avatar Apr 08 '21 23:04 equatorlounge