I am attempting to set up a very simple webpack config file which would take all scss files within a project (including nested folders) and transpile and output to a single CSS file in the dist folder. I am using the MiniCssExtractPlugin to accomplish this
Sounds easy enough but i'm not having any luck setting it up, below are the contens of my webpack.config.js file:
const path = require('path');
const { resolve } = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.css$/,
include: resolve(__dirname, 'node_modules', 'react-toolbox'),
use: [
MiniCssExtractPlugin.loader,
// 'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
localIdentName: '[name]_[local]_[hash:base64:5]'
}
},
// 'postcss-loader'
]
},
{
test: /\.scss$/,
use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
},
{
test: /\.css$/,
exclude: resolve(__dirname, 'node_modules', 'react-toolbox'),
use: ['style-loader', 'css-loader']
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'style.css',
}),
],
};
Ny ideas where I'm going wrong?