DocSpring / craco-antd

A craco plugin to use Ant Design with create-react-app
MIT License
234 stars 49 forks source link

cssLoaderOptions.localIdentName changes antd styles #11

Open sdli opened 5 years ago

sdli commented 5 years ago

image

Antd styles changes too

"@craco/craco": "^3.2.3", "antd": "^3.11.6", "react-scripts": "2.1.1", "craco-antd": "^1.9.3",

ndbroadbent commented 5 years ago

I think this is the expected behavior. cssLoaderOptions is passed to the Less loader, so this will change all of the CSS class names.

If you want to turn it off just for the antd styles, then I think you might need to add your own custom webpack rules with an exclude or test regex. Or maybe I can add something in craco-antd to support this.

Can you please explain a bit more about what you are trying to do?

sdli commented 5 years ago

I think this is the expected behavior. cssLoaderOptions is passed to the Less loader, so this will change all of the CSS class names.

If you want to turn it off just for the antd styles, then I think you might need to add your own custom webpack rules with an exclude or test regex. Or maybe I can add something in craco-antd to support this.

Can you please explain a bit more about what you are trying to do?

Thank you, I wrote a webpack configuration file , and I have fixed it.

ndbroadbent commented 5 years ago

Ok great! I will leave this issue open for now, and I might add an easier way to solve this in the future. It would be good if you could apply some options to your own Less files without affecting the antd Less.

tikkichan4 commented 5 years ago

Just having the same problem, i would like to use babel-plugin-react-css-modules + craco-antd to rename all of the customized classes excluding antd classes. But currently it seems not worked if not changing the webpack config directly.

ndbroadbent commented 5 years ago

@tikkichan4 Sorry about that!

I think I just need to exclude the antd Less files with a regex, or even exclude everything in /node_modules/. I have added this to my todo list and should be able to get it fixed soon,

ndbroadbent commented 5 years ago

Sorry for the delay on this issue. Unfortunately I don't have much time to spend on craco-antd, but it would be great if someone could help with a PR for this issue. Thanks!

Arrow66 commented 3 years ago

I think this is the expected behavior. cssLoaderOptions is passed to the Less loader, so this will change all of the CSS class names. If you want to turn it off just for the antd styles, then I think you might need to add your own custom webpack rules with an exclude or test regex. Or maybe I can add something in craco-antd to support this. Can you please explain a bit more about what you are trying to do?

Thank you, I wrote a webpack configuration file , and I have fixed it.

Hi , Can you please share the fix here . i am also facing the same