sass-loader: Error: Missing whitespace after :global
This is my style:
Error
.wrap-box {
margin: 15px 0;
:global {
&.box {
.otherClass {
width: 44px;
height: 44px;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
}
}
}
}
Error message
Module build failed: Missing whitespace after :global (3:3)
How can I fix this issue.
Sorry if the issue is already there but I can not find it.
Thanks!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (7 by maintainers)
any workaround?
I’ve created my React app with
create-react-app
v3.0.1
and I’m trying to use CSS modules.I want to make the following CSS:
which I think it should output
edit:
I found this workaround: https://github.com/css-modules/css-modules/issues/295#issuecomment-404873976
less + css modules also has this problem. after looking into the workaround: https://github.com/webpack-contrib/sass-loader/issues/507#issuecomment-509759139 just add
&
before:global
works for me (*.module.less in vite)I want complier from
to
@evilebottnawi @michael-ciniawsky Here is a reproduction, please help to locate this issue.
https://github.com/JounQin/issues/tree/scss-global-selector
@chacbumbum can you try escape
\:global
? I am not familiar with css modulesdownvotes are probably from Next.js users which the workaround doesn’t work for because next.js doesn’t recognize the workaround as a “pure selector” so it errors.