I think I followed the documentation correctly, but it does not work at all.
What I want is to generate a css file, and do not load it in style tags with js.
In my src directory:: "scss/custom.scss" and "style.scss", and none of them is generated in output.
EDIT: src code: https://github.com/marcosroot/webpackexample
My settings are:
const path = require('path');
const BundleTracker = require('webpack-bundle-tracker');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const devMode = true;
module.exports = {
entry: [
'./src/toggle_menu.js',
'./src/calls_apis.js'
],
output: {
path: path.resolve(__dirname, "dist"),
filename: devMode ? 'main.js' : 'main.[hash].js',
},
plugins: [
new BundleTracker({
filename: './webpack-stats.json'
}),
new MiniCssExtractPlugin({
filename: devMode ? '[name].css' : '[name].[hash].css'
})
],
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
}
},
{
test: /\.scss$/,
include: path.resolve(__dirname, 'scss/custom.scss'),
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader',
]
}
]
},
}
new MiniCssExtractPlugin({filename: DEV ? '../css/_.css' : '../css/_-[contenthash].css'}),
β Hays