Reputation: 977
The scss file in not compiling in reactjs even after having the required dev dependencies .I have used create-react-app to create the app. Here is the package.json file.
{
"name": "mydecisionapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"css": "^2.2.1",
"loader": "^2.1.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-modal": "^3.1.11",
"react-scripts": "1.1.0",
"style": "^0.0.3",
"validator": "8.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"css-loader": "^0.28.9",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"style-loader": "^0.20.1",
"webpack": "^3.10.0"
}
}
Here is the package style.scss file .
$brand-color:blue;
* {
color: $brand-color;
}
I looked at all imports in index.js file and it is completely ok but still, I don't see scss compiling .
Upvotes: 2
Views: 9176
Reputation: 680
npm i sass-loader node-sass
I was having the same issue, and it worked for me :)
Upvotes: 0
Reputation: 861
Pls ensure that your version of react-scripts inside the the package.json file is at least 2.0.0.
This is stated at the top of the documentation that can be found here: https://create-react-app.dev/docs/adding-a-sass-stylesheet
Note: this feature is available with [email protected] and higher.
Upvotes: 0
Reputation: 15
create-react-app is not configured by default to support scss files. Try reading this How to add SASS/SCSS to a create-react-app
Upvotes: 1