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.

Webpack + React Support

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
madyankincommented, Dec 28, 2016

Yes, you have to use JSON files. You can write a Babel plugin which would transform imports.

2reactions
pruettcommented, Mar 29, 2016

It’s odd because a styles.css.json file is created in the same directory and shows the correct mapping, but console.log(styles) returns an empty object in the React render method.

Read more comments on GitHub >

github_iconTop 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 >

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