babel-plugin-react-css-modules icon indicating copy to clipboard operation
babel-plugin-react-css-modules copied to clipboard

Not compatible with [email protected]

Open ThiefMaster opened this issue 6 years ago • 4 comments

I have localIdentName set to '[path]___[name]__[local]___[hash:base64:5]' in the css-loader, but as of 3.0.0 this generates a name (in css-loader) where slashes and dots aren't replaced with dashes but rather escaped.

That's a bit uglier to read now (anyway, they aren't really meant for humans) -- but the main problem is that this plugin now generates invalid className values because it's using the old logic.

Example:

className: rb-client-js-modules-landing-___Landing-module__landing-page-card___kz6iY css: .rb\/client\/js\/modules\/landing\/___Landing\.module__landing-page-card___kz6iY

ThiefMaster avatar Jun 24 '19 16:06 ThiefMaster

Same error for me. 🙃

krailler avatar Jul 03 '19 15:07 krailler

Good first PR.

gajus avatar Jul 03 '19 17:07 gajus

I solved the problem with this...

const defaultGetLocalIdent = require('css-loader/dist/utils').getLocalIdent

modules: {
    ...
    getLocalIdent: (...params) => defaultGetLocalIdent(...params).replace(/\\\//g, '-'),
    ...
}

krailler avatar Jul 03 '19 17:07 krailler

Currently, [email protected] doesn't export getLocalIdent anymore.

purefun avatar Jul 26 '20 14:07 purefun