-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import scss files to a current scss file --> Could not resolve styleName error #202
Comments
Have you installed
|
Think I have the same issue. And yes I have the configs as described, in .babelrc
Without the filetype config, it would be a different error: |
Yes, my config file is exactly like that. I had to remove that to finish my assignment in school so I dont have my config file right now but my config file was the same as it in webpack.config.js. |
Is there a school course that teaches to use babel-plugin-react-css-modules? |
No, they just said you can do whatever you want with front-end we dont care so I use react loll. |
I also have the same problem - specifically, I have a sass mixin I call from the imported stylesheet which has child classes i.e. mixins.sass:
in my component.sass file I have:
This produces the error If I change this to be:
Then the error is removed and the compile succeeds. The title div gets both the font-size attributes and display styles so it seems this is only a pre-compile issue. I can even then remove the above code and the compile will continue to succeed - so it seems the check is only done at certain times - however, restarting Webpack will always cause the error to return so this isn't in any way a workaround. Adding such additional classes as a workaround is also pretty annoying as they're not required styles and this must be done for all styleNames in each place a mixin is used - which mitigates most of the benefits of using a mixin. |
You have to install https://github.com/longlho/postcss-import-sync2 and import it as the first plugin like below (configuring babel-plugin-react-css-modules). Maybe newer Edit: async plugins are not supported,
|
@hinok I can't get this to work properly with .scss and it's driving me crazy, could you please post your demo to GitHub? |
@jkhaui Look at Commit: hinok@0bf3624 I upgraded also |
@hinok amazing, thank you so much! Exactly what I was looking for :) |
Hey in my case the only way to solve the issue without adding any extra .classname
// stylename ignore - start line
+mixin
// stylename ignore - end line Hope it helps. |
In my case, it seems to have been because the plugin expects some things to be in alphabetical order.
and error that it couldn't find adaptive. Changing it to this fixed it:
After it was fixed, if I attempted to replicate it, the issue would not occur anymore... |
@hinok This implementation is not working as its throwing error as postcss 8 required by postcss-import-sync2 |
Basically what I was doing is that I have a scss files name "_abc.scss" which is imported into "abcd.scss" and then I import "abcd.scss" to my "main.js" file. In my "main.js" I use a class that is defined in "_abc.scss" and it results in "could no resolve the styleName ...". Any ideas how to resolve this issue?
The text was updated successfully, but these errors were encountered: