Worse Experience in React. I just installed React and eject When I tried to use css-modules but I was unable because the all webpack.config.dev.js code has changed which was before we configure like modules: true, localIdentName: '[name]_[local]_[hash:base64:5]'
but Now this option is disappeared Please give me some expected Guide as possible as with example.
Best regard.
CSS Modules work out of the box in Create React App.
If you eject, you're on your own -- sorry. The webpack documentation would be a great place to start.
Sorry, but in this case CSS modules should work by default in ejected CRA, or it does break an app, and eject is useless
CSS Modules work after ejecting. If they don't please file a new issue.
@John99Dev I was struggling like you with the same issue, because it is supposed to work by default but it's not completely true.
Before this release, we could import the css module from a plain Button.css
file, now you have to rename your css file to Button.module.css
. It solved the problem for me.
I solved it couple days before by the old way Which we use like this
test: cssRegex,
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
}),
Include the modules: true,modules: true, localIdentName: '[name]__[local]__[hash:base64:5]'
at line 271 below. It works well As I expected
So Enjoy it Again!
I solved it couple days before by the old way Which we use like this
test: cssRegex, exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, modules: true, localIdentName: '[name]__[local]__[hash:base64:5]' }),
Include the modules: true,
modules: true, localIdentName: '[name]__[local]__[hash:base64:5]'
at line 271 below. It works well As I expectedSo Enjoy it Again!
Thank you @John99Dev .
@John99Dev I was struggling like you with the same issue, because it is supposed to work by default but it's not completely true.
Before this release, we could import the css module from a plainButton.css
file, now you have to rename your css file toButton.module.css
. It solved the problem for me.
That's works pretty good for me! Thanks
Most helpful comment
I solved it couple days before by the old way Which we use like this
Include the modules: true,
modules: true, localIdentName: '[name]__[local]__[hash:base64:5]'
at line 271 below. It works well As I expectedSo Enjoy it Again!