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.

Css Modules not working directly from scss files

See original GitHub issue

I’m trying to create a new project with:

create-react-app myapp --scripts-version custom-react-scripts

and the following .env file (in root of project):

REACT_APP_SASS=true
REACT_APP_LESS=false
REACT_APP_STYLUS=false
REACT_APP_CSS_MODULES=true

In my component I then try to import a .scss file but it is not creating the styles object correctly and I am getting no styles. e.g.

import style from './style.scss';
console.log(style);

   ... className={style.label} ...

I’m using version 1.0.3 of create-react-app, is this the problem? do I need to use an older version? Or what could be the issue?

Thanks, and great project!

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
Swinejamincommented, Apr 11, 2017

Any update on this? I’m still not able to make this work, either.

1reaction
kitzecommented, Mar 15, 2017

This will be supported in the next version (released by this sunday) @jnmandal @danielanteloagra

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS modules not working for react version 16.6.0
Not working with React 17.0.1. The only way to make it work is Changing to UpperCase all the css classes in the css...
Read more >
How to use Sass and CSS Modules with create-react-app
A CSS Module is a CSS file in which all class names and animation names are scoped locally by default. Basically, same class...
Read more >
React + Storybook + SCSS modules not working · Issue #17768
It literally works right out the box, with css/scss/global styles AND modules. My main.js file now looks like this: const path = require('path ......
Read more >
How to Use Sass with CSS Modules in Next.js - freeCodeCamp
CSS Modules are essentially CSS files that, when imported into JavaScript projects, provide styles that are scoped to that particular part of ...
Read more >
Setup React CSS Modules (with SASS, multiple classes and ...
In this tutorial I want to show you a few tips on how to setup modular scopes css along with setting up sass...
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