Closed
Description
I am having issues configuring this plugin on mode: 'production'
. The CSS bundle is not generated. However, for some reason everything works as expected if I switch to mode: 'development'
. Is this expected?
Here is a minimal setup to test this out:
webpack.config.js
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require('path');
module.exports = {
mode: 'production',
entry: [
path.resolve(__dirname, 'src/index.js')
],
output: {
filename: '[name].[chunkhash].js'
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[chunkhash].css'
})
],
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
}
]
}
};
src/index.js
import './styles.css'
styles.css
body {
background-color: blue;
}
Here is what I am using:
OS: Arch
webpack: 4.1.1
mini-css-extract-plugin: 0.2.0
css-loader: 0.28.10
node: 8.9.4
yarn: 1.5.1
Note: I tried this in a more complicated configuration using html-webpack-plugin
, babel-loader
, etc. Everything works normally on development
, but it doesn't on production
. Let me know if you would like me to provide that configuration as well!
Metadata
Metadata
Assignees
Labels
No labels