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

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

オープン
#304 コメント 7 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
2k
フォーク
159
PR マージ指標
30日以内にマージされた PR はありません

説明

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~

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

リポジトリのファイルもテストも指定されていません。まず、plugin が generic-names をどのように統合しているかを追跡し、その scoped-name の生成をリンク先の generic-names v3 の更新と比較してください。新しい webpack/css-loader のバージョンが手動設定の回避策なしで動作すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
babel, javascript, webpack
領域
build-system, frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。