Struggling to integrate .scss stylesheets into my ReactJS app using webpack configuration file with
css-loader, sass-loader, and style-loader.
Successfully imported css into app.js using import './test.css'
but facing issues with import './test.scss'
.
Below is my package.json:
"dependencies": {
"react": "^15.0.2",
"react-dom": "^15.0.2"
},
"devDependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babelify": "^7.3.0",
"checkbox.css": "^1.1.1",
"css-loader": "^0.23.1",
"eslint": "^2.9.0",
"eslint-plugin-react": "^5.0.1",
"html-webpack-plugin": "^2.16.1",
"node-sass": "^3.7.0",
"raw-loader": "^0.5.1",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
}
My webpack setup includes:
module:{
loaders:[
{test:/\.js$/,exclude: /node_modules/, loader: 'babel-loader'},
{test:/\.scss$/, loaders:['style','css','sass']},
// {test:/\.css$/, loader: 'style!css', exclude: /node_modules/},
{test:/\.html$/, loader: 'raw-loader'}
]
},
****The line mentioned above is commented out due to successful css loading step.**
In my app.js, I've experimented with
require("!style!css!sass!./styles.scss");
and also attempted import './styles.scss'
without any luck.
The current error message reads as follows:
Uncaught Error: Cannot find module "./../../node_modules/css-loader/lib/css-base.js"