Sep 9, 2018
0
Level 3
MiniCssExtractPlugin doesn't compile scss files into css files
Hi. I don't understand the behave of MiniCssExtractPlugin. I have style folder where .scss files are placed. But when I run webpack no css files appear in dist folder. May be I do something wrong. If somebody knows how to make it right, tell me. Thank you in advance )
Here is a webpack.config.js file
const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const NODE_ENV = process.env.NODE_ENV;
const devMode = NODE_ENV !== 'production';
module.exports = {
cache: false,
mode: NODE_ENV,
entry: './src/js/main.js',
output: {
path: __dirname + '/dist',
filename: "bundle.js"
},
resolve: {
alias: {
"bxslider": 'bxslider/dist/jquery.bxslider.js'
}
},
module: {
rules: [
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader
'css-loader',
'sass-loader'
]
},
{
test: /\.(jpg|jpeg|png|svg)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'img/',
publicPath: '/dist/img/'
}
}]
},
{
test: /\.(o|t)tf$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
publicPath: '/dist/fonts/'
}
}]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'main.css'
})
],
devtool: 'source-map'
}
Please or to participate in this conversation.