-
-
Notifications
You must be signed in to change notification settings - Fork 609
The @scope rule does not generate class name in CSS Modules #1579
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
The @scope rule does not generate class name in CSS Modules #1579
Comments
There's a mistake in my code, but if I type |
I see, we need to inject empty class in such case, if you want you can send a PR |
Can't we just add the class name to the javascript object? The class name does exist, the CSS is compiled fine, the problem is only with the |
hm, we have a test case https://github.com/webpack-contrib/css-loader/blob/master/test/__snapshots__/modules-option.test.js.snap#L10313, but yeah, I see we don't add |
I think we need just change |
Fixed, update your transitive deps |
Bug report
If I try to import certain class names from
*.module.css
files that are declared only with@scope
rule, I receiveundefined
instead of a proper class name.Actual Behavior
And the problem is: the styles are not applied.
css-loader
correctly compile the CSS, in my HTML file everything is okay. Butstyles.root
containsundefined
.Expected Behavior
The class name should be defined.
I found a workaround: you can simply add the usage of a desired class name outside of
@scope
rule (in my case.root {}
) into your CSS file. But it feels like, CSS Modules should work with@scope
rule without such the workaround.How Do We Reproduce?
Here's a snippet of CSS code:
And this is how I use it in JavaScript
Webpack configuration:
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: