Skip to content

Updated FAQ section with example configuration for webpack 2. #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,26 @@ To enable live reloading of the CSS:
> Note:
>
> This is a [webpack](https://webpack.github.io/) specific option. If you are using `babel-plugin-react-css-modules` in a different setup and require CSS live reloading, raise an issue describing your setup.

### How to use with webpack 2?
In your webpack.config.js file you will need to add the babel-plugin-react-css-modules as a plugin to your babel loader.
It will look like this:
```
module: {
rules: [
{
test: /\.jsx?$/,
use: {
loader:'babel-loader',
options: {
plugins: [require('babel-plugin-react-css-modules').default]
}},
exclude: /node_modules/
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader?importLoader=1&modules&localIdentName=[path]___[name]__[local]___[hash:base64:5]', ],
},
],
}
```