-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Composing class from another scss css modules results in invalid stylesheet in production #7596
Comments
We fixed this problem in our main codebase by ejecting it and making this change joshhunt/destinyDataExplorer@a25e3e0 to the webpack config. I don't understand why this fixes it. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
no please don't |
got a similar problems too, may related to #7777 |
need help with same issue |
need help with the same |
Same issue here! |
For me, it happened when upgrading from react-scripts 3.0.1 to 3.1.0 |
…ported for variables issue react-scripts introduced a weird issue where scss modules that are used both in composing and imported have their imported values broken. facebook/create-react-app#7596
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Any news on this? |
I submitted a pull request to fix this issue, but unfortunately it has not been looked at yet #7950 :) |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Describe the bug
SCSS + CSS Modules problem.
During production build only, Composing from one SCSS + CSS Modules stylesheet into another results in invalid CSS in the final main.hash.chunk.css stylesheet. This problem does not occur when doing a development build.
In the final css file, there are basically two copies of the composed stylesheet, one of which has not been processed by Sass, the the other of which has missing properties (only properties that had sass variables?) . This results in invalid syntax in the file, and invalid styles.
Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
I've searched to see if there's any caveats with using Sass and CSS Modules together. It did not appear there are any.
Environment
Steps to reproduce
App.module.scss
, as a stylesheet using Sass features (such as variables for background colour)other.module.scss
, as a stylesheet, with a class name that composes something fromApp.module.scss
App.module.scss
andother.module.scss
yarn build
Expected behavior
Styles are fine. It should look like this https://deploy-preview-9--destiny-data-explorer.netlify.com, and the compiled stylesheet should something like this https://gist.github.com/joshhunt/d2efc72f133e448b0c67a93bb1bde36d#file-correctbutnocomposes-css
Actual behavior
Styles are not fine, it looks like this https://deploy-preview-8--destiny-data-explorer.netlify.com and the compiled stylesheet looks something like this https://gist.github.com/joshhunt/d2efc72f133e448b0c67a93bb1bde36d#file-wrong-css
As seen in the linked file, the Sass variables have not been compiled away.
Reproducible demo
I have created a minimal reproduction branch here https://github.com/joshhunt/destinyDataExplorer/tree/cra-repro/bug which has been deployed https://deploy-preview-8--destiny-data-explorer.netlify.com
If I comment out the
composes:
the issue does away, which you can see deployed here https://deploy-preview-9--destiny-data-explorer.netlify.comThe text was updated successfully, but these errors were encountered: