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

[contenthash] generated by this plugin does not match the hash generated by css-loader 5.2.0

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

説明

Content hashes in css class names generated by this plugin are not the same as the hashes generated by `css-loader`.

Example:

`babel-plugin-react-css-module` => `navbar__container___2dO7z`
`css-loader` => `navbar__container___ocJ3d`

Debugging webpack reveals the reason - the `options.content` values used are different. Example (actual library name replaced by `xxx`):

`content` value used by `babel-plugin-react-css-module`:

```
node_modules/xxx/components/Navbar/navbar.scss+container
```

`content` value used by `css-loader`:

```
node_modules/frontier-pub/components/Navbar/navbar.scss[NIL]container
```

In the second value above, `[NIL]` is `\x00`

This `\x00` character is used in `css-loader/dist/utils.js` like this:

```js
options.content = `${options.hashPrefix}${relativeMatchResource}${relativeResourcePath}\x00${localName}`;
```

Versions:
* css-loader: 5.2.0
* babel-plugin-react-css-module: 5.2.6

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

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

調査の方向性

まず、報告されている css-loader 5.2.0 と babel-plugin-react-css-module 5.2.6 の例を使って、css-loader/dist/utils.js におけるコンテンツ構築と、プラグインのハッシュ生成パスを比較します。navbar.scss のコンテナケースを再現し、両方のツールが同じコンテンツハッシュを生成することを確認します。

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

評価

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

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

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