gajus / gajus/babel-plugin-react-css-modules

Temporary fix for those have trouble with newer version of webpack / css-loader.

Aperta
#304 7 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2k
Fork
159
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

It turns out that `babel-plugin-react-css-modules` is using `generic-names` v2, which is different a bit with newer `Webpack` in the [hash].

`generic-names` v3 solve it. see [this update](https://github.com/css-modules/generic-names/commit/191c17e0784275e7918700d3bed3dc0195408259).

So we can manually replace the `generateScopedName` with `createGenerator` from `generic-names` v3.

Like this

``` JavaScript
const createGenerator = require('generic-names');

const plugins = [
[
'babel-plugin-react-css-modules',
{
generateScopedName: createGenerator('[name]__[local]_[hash:base64:5]'),
exclude: 'node_modules',
},
],
];
```

I've done this in my own project and it works fine. Have a try. Best wishes~

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.