kriasoft / isomorphic-style-loader

CSS style loader for Webpack that is optimized for isomorphic (universal) web apps.

Home Page:https://reactstarter.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import css does not return the classes

kbruneel opened this issue · comments

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

commented

Hi @kbruneel whats version of css-loader do you use?

Seeing the same issue. Tried with css-loader 3.6.0 and 5.0.1.

Fixed by adding "modules: true" to css-loader options.

Closing, as this issues has a solution.