sass-loader: sass-loader can't resolve :global or :local on css-module on .sass extension
:global
and :local
isn’t working with sass-loader with .sass extension
I tried to switch to less and stylus loader and it works perfectly. Not sure this is my fault in configuration ? or just sass syntax doesn’t allow :global
and :local


{
test: /\.sass$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[local]-[hash:base64]'
}
},
{
loader: 'postcss-loader'
}, {
loader: 'sass-loader'
}]
},
SOLUTION: If anyone get this problem, /:global
will fix the problem.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 17 (7 by maintainers)
escaping is possible using
\:global
not/:global
@thomashibbard what worked for me was something like:
Why is that we do not have to escape when using
.scss
, and only with.sass
?It seems that dart sass complains about
:global
:I’m running into this same issue. Escaping with
\:global
is still throwing aModuleParseError
:@evilebottnawi Found the problem, for .sass you need to escape
/:global
to make it possible to compile with its syntax and pass to css-loader. thanks for the help btw!@jarindr please create minimal reproducable test repo, we will not help you if you do not provide information, good issue - issue with detailed information, not empty 👍