From d0539dc9ba0f13612ee3aa162b372c9d187ca029 Mon Sep 17 00:00:00 2001 From: Anton A Date: Wed, 21 Apr 2021 15:40:25 +0930 Subject: [PATCH] Update readme.md Add css-loader and babel-plugin-react-css-modules compatibility note. --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index c169890..dabf548 100644 --- a/readme.md +++ b/readme.md @@ -15,3 +15,11 @@ var generate = genericNames('[name]__[local]___[hash:base64:5]', { generate('foo', '/case/source.css'); // 'source__foo___3mRq8' ``` + +## Compatibility + +### With Webpack's `css-loader` and `babel-plugin-react-css-modules` + +Starting from version `3.0`, this plugin is not compatible with `babel-plugin-react-css-modules` running under `css-modules<3.6.0` due to [this update](https://github.com/webpack-contrib/css-loader/commit/d2f6bd2755a513e98faca84c3f52544be72d53f3). + +Explanation: starting from `3.6.0`, css-modules uses `\x00` instead of `+` when generating `content.options` consumed by Webpack when generating `[hash]` and `[contenthash]`, as can be seen in [this update](https://github.com/webpack-contrib/css-loader/commit/d2f6bd2755a513e98faca84c3f52544be72d53f3#diff-3274f1a37032fb0ae4e2823def0007c634e869ae0dfc304ff6a12c36513c3a52R49). As a result, the hash value generated by the react css modules plugin is not the same as the one generated by Webpack's css-loader.