Cannot import scss/sass
See original GitHub issuePrerequisites
- Using yarn
- Using an up-to-date
masterbranch - Using latest version of devtools. Check the docs for how to update
- Tried solutions mentioned in #400
- For issue in production release, add devtools output of
DEBUG_PROD=true yarn build && yarn start
Expected Behavior
While importing [.scss/.sass] files, the application (yarn dev) should build with no errors.
Current Behavior
When I import [.scss/.sass] files (ex changing Home.css to Home.scss), the application (yarn dev) gives me this error:
ERROR in ./app/components/Home.scss
Module build failed (from ./node_modules/typings-for-css-modules-loader/lib/index.js):
Error: Cannot find module 'css-loader/locals'
Steps to Reproduce
-
Change the file
./app/components/Home.cssto./app/components/Home.scss(or .sass) -
Change the file
./app/components/Home.tsxto reflect the change mentioned above. -
Run
yarn dev
Possible Solution (Not obligatory)
Probably Webpack is not properly configured to process scss/sass, even though it has rules to deal with those file extensions.
Context
I’m trying to use scss/sass files, as it is common in React, and this error is happening.
Your Environment
- Node version : v12.18.1
- electron-react-boilerplate version or branch : master
- Operating System and version : Windows 10
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Can't import CSS/SCSS modules. TypeScript says "Cannot ...
In a webpack configuration that pipes *.scss files through sass-loader → css-loader → style-loader, there will be no content in the imported module, ......
Read more >Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >sass-loader - webpack - JS.ORG
Loads a Sass/SCSS file and compiles it to CSS. ... If it cannot be resolved, then the loader will try to resolve @import...
Read more >SCSS cannot resolve imports (node_modules) in IDE - YouTrack
SCSS cannot resolve imports (node_modules) in IDE - but actually works on ng serve. Relates to 2 Duplicates 1. Relates to 2 issues...
Read more >Cannot Find Module 'XXX.scss' or Its Corresponding Type ...
First of all, make sure that webpack and sass have been able to recognize the CSS Module, please refer to the webpack official...
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 Free
Top 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

This might have been fixed in the most recent version of ERB, released yesterday. Please check if those changes work for you
@amilajack Is this still an ongoing problem? I have the latest version of ERB (
v2.1.0) and am still encountering an issue where I can’t import*.scssfiles from a*.tsxfile.Update:
I was able to remove this typescript error by adding a
declaration.d.tsfile in the root project directory with the following contents:StackOverflow Issue