Webpack + React Support
See original GitHub issueI’m trying to use this package on a React app powered/bundled with webpack.
Through the following declaration in webpack, I’m able to generate a style.css
file which appears to be working as the resulting css produces hashed names for classes…
{ test: /\.css$/
, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!postcss-loader')
, exclude: [/node_modules/]
}
However, within a React component, a <p className={styles.element}>...</p>
for example, does not inject the name of the css-module class ._element_1119m_1
for example.
Do you have any experience or knowledge of React compatibility?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to React with Webpack 5 - Setup Tutorial
Let's dive into my personal minimal setup for a React project. This tutorial supports the latest versions of React, Webpack 5, and Babel...
Read more >Using Webpack with React, Pt. 1 - Toptal
In this Webpack tutorial, we demystify Webpack/React configuration. ... These templates are able to support application development at a very large scale.
Read more >React setup with webpack for beginners - DEV Community
There are many ways to set up a react project and the popular ones you may hear of create-react-app and webpack. So today...
Read more >Setup react with webpack and babel - Medium
Guide to setup react from scratch, without using create-react-app and by configuring webpack and babel manually. Table of content. Setup React
Read more >Creating a React app with Webpack - JavaScript Ramblings
Creating a React app with Webpack · Step 1: Base scaffolding · Step 2: Adding Webpack · Step 3: Adding Babel · Step...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, you have to use JSON files. You can write a Babel plugin which would transform imports.
It’s odd because a
styles.css.json
file is created in the same directory and shows the correct mapping, butconsole.log(styles)
returns an empty object in the Reactrender
method.