-
-
Notifications
You must be signed in to change notification settings - Fork 161
Adding "composes" doesn't update className #48
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
Comments
I have similar experience
works fine on start, but if I change .test class to a camelCase name and adjust composes reference it no longer works and the background is no longer red. |
Hi, I've done some further testing and it seems like there some kind of caching going on??? Now heres where it gets weird... if I import the same stylesheet into another component and add the classname to it it picks up the new class that is being composed even thos the other element which is using the exact same class isn't.
In the code above the class I don't understand how they can be different, both import the same stylesheet and both use the Its not a cascade issue either from a global style Also stoping the dev server and restarted yields the same result Then I stoped the server and changed the variable name I was importing the stylesheet with suspecting that when started again both will finally have the same style, and sure enough both had the same style applied. I have no idea whats going on but I hope these descriptions can give some clues. Cheers |
PR is welcome. |
👍 |
I have learned through much experimentation that the following laborious scenario will get the class name in the compose reflected every time on the element when it doesn't get caught during dev reloads (which it never does for me):
So yes, a caching issue and it sounds from your response @gajus that there may be more of an enhancement needed here than a bug fix? @aevk @rhysburnie have either of came to any other realizations or solutions yet? |
@lorenjohnson no after spending a while on it I decided to just use plain css as I didn't want to get bogged down on styling at the time. Its interesting that what you describe involves the babel-loader in a completely seperate rule to the css rule. I had assumed rules were treated separately, its scary if an unrelated rule can affect another. |
@lorenjohnson in my case, I don't have a cacheDirectory specified, but the issue still happens.
If i have a cache specified, then removing the cache helps in one particular scenario as mentioned here: #105 (comment) but does not help directly with the Not really sure, why it only happens with |
Let's say I have this code:
The output styles will be something like
Now if I add "composes"
the component class remains the same (only has styles-block_3XNkZ). Even if I refresh page (f5) it will not help because webpack output js still has old css name (like):
If I change somehow the component it will trigger the changes, and the component will has the correct classes
I use
I tried https://github.com/gajus/babel-plugin-react-css-modules/tree/master/demo, and got the same
behavior.
The text was updated successfully, but these errors were encountered: