question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use CSS-module in webpack 4.19, React 16.5?

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
lifeericcommented, Oct 25, 2018

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!

5reactions
do-diegoortizcommented, Oct 26, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to setup and use CSS/modules in React with Webpack
This post will guide you through setting up webpack for importing both globally scoped CSS modules and locally scoped CSS modules and how...
Read more >
How to configure CSS Modules for webpack - LogRocket Blog
In this article, we will practice using CSS Modules with a webpack demo project in order to learn how to configure an app...
Read more >
How to use ReactJS with Webpack 4, Babel 7, and Material ...
So after a number of requests, we created this little tutorial about how to start using React with Webpack 4 and Babel 7....
Read more >
Tips to Use ReactJS with Webpack 4, Babel 7, and Material ...
This tutorial is about how to use React with Webpack 4 and Babel 7, and by the end of this tutorial, you will...
Read more >
How to Create a React Application from Scratch with Babel ...
Webpack is a module bundler that takes all the files in your project and outputs ... Run npm install --save react@16.5.2 react-dom@16.5.2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found