Reputation: 387
Can't figure out how to compile main.scss file to styles.css with webpack4. All javascript and scss are compiled to a single app.js file
My package.json file:
webpack.config.js file:
I want to compile my main file /src/styles/styles.scss to dist/styles.css
Upvotes: 1
Views: 1692
Reputation: 432
You could try redefining the use property of the .scss rule.
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
]
},
Then add this to your plugins:
plugins: [
...,
new MiniCssExtractPlugin({filename: '[name].css',})
]
That should compile it all into the dist/ folder, as a separate .scss file. Edit: as a separate .css file.*
Upvotes: 3