Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistency with css-loader #8

Closed
deanshub opened this issue Dec 18, 2019 · 8 comments · Fixed by #10
Closed

inconsistency with css-loader #8

deanshub opened this issue Dec 18, 2019 · 8 comments · Fixed by #10

Comments

@deanshub
Copy link

the regex at this line breaks consistency with css-loader generation getLocalIdent

the test case is @ in node modules, scoping packages is getting popular and when we use the same parameters (localindentname, hashprefix,...) with requiring css from a node module that has @ in it, generic-names replaces it with - but css-loader leaves it as @

That's because, \u00A0-\uFFFF doesn't contain @

@benmvp
Copy link
Contributor

benmvp commented Oct 22, 2020

I'm having a similar problem, but w/ a different line of code. 😄

This PR changed the content being passed to interpolateName (in loader-utils) from including a plus + to including \x00. This is now in css-loader >= 4. However, generic-names still using + so there's now an inconsistency in how the class names are generated.

Given that this library is basically piggybacking on what webpack does, it seems like it should be updated to match. I already asked in css-loader and the change was intentional (webpack-contrib/css-loader#1214).

The actual problem I'm having is with babel-plugin-react-css-modules which uses this package to generate the class names. See: gajus/babel-plugin-react-css-modules#291

@benmvp
Copy link
Contributor

benmvp commented Oct 22, 2020

@evilebottnawi is this something that can be changed here then?

@alexander-akait
Copy link
Member

Why do you need generic-names?

@benmvp
Copy link
Contributor

benmvp commented Oct 23, 2020

@evilebottnawi - babel-plugin-react-css-modules uses generic-names in order to generate its scoped names. And since generic-names no longer uses the same format as css-loader v4+ (see above), babel-plugin-react-css-modules is broken with css-loader v4+.

Here's the open issue: gajus/babel-plugin-react-css-modules#291

@alexander-akait
Copy link
Member

@benmvp You can send a PR

@alexander-akait
Copy link
Member

Just copy logic from css-loader to here

@benmvp
Copy link
Contributor

benmvp commented Oct 23, 2020

Cool, that was my plan, but wanted to make sure you were ok with it.

@alexander-akait
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants