1

I have my webpack config loaders as like this:

//config for css
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.png$/, loader: "url-loader?limit=100000" },
{ test: /\.jpg$/, loader: "file-loader" }

and in my React component I have:

import styles from "../../../css/style.css"

and my style.css looks like:

#box {
}

but in my react component if I refer to styles its just returning {}, I expect it should have box key. But it doesn't, where I'm making mistake?

0

1 Answer 1

1

I think you need enable css-modules

{ test: /\.css$/, loader: "style-loader!css-loader?modules" 

Example

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.