import css does not return the classes
kbruneel opened this issue · comments
Karel Bruneel commented
Hi,
When I do: import s1 from "./button.css";
And then try: s1.button
This returns undefined
.
When I console.log(s1)
I get:
{_getContent: ƒ, _getCss: ƒ, _insertCss: ƒ}
_getContent: ƒ ()
_getCss: ƒ ()
_insertCss: ƒ (options)
__proto__: Object
button.css contains:
.button {
...
}
In my webpack config I have:
{
test: /\.(css|scss)$/,
use: [
'isomorphic-style-loader',
{
loader: "css-loader",
options: {
importLoaders: 1
}
},
'postcss-loader'
]
}
I'm really out of ideas of what I'm doing wrong. Thanks for your help!
Karel
Victor Ionescu commented
Seeing the same issue. Tried with css-loader 3.6.0 and 5.0.1.
Victor Ionescu commented
Fixed by adding "modules: true" to css-loader options.
Michael Duve commented
Closing, as this issues has a solution.