I tried to extract all css into a single file, using your example.
But I end up with three css files.
Could someone take a short look, to see what is wrong.
Here is a little repo.
Plugins:
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "[name].css",
// chunkFilename: "bundle.css"
})
and:
optimization: {
minimize: true,
runtimeChunk: false,
splitChunks: {
cacheGroups: {
styles: {
name: 'bundle',
test: /\.css$/,
chunks: 'all',
enforce: true
},
vendor: {
chunks: 'initial',
name: 'vendor',
priority: -10,
test: /node_modules/
// test: /node_modules\/(.*)\.js/
}
}
}
}
@Legends can you provide full config, maybe you have multiple entry point
As you're using scss files too:
styles: {
name: 'bundle',
test: /\.(css|scss)$/,
chunks: 'all',
enforce: true
},
Let's add this to documentation :+1:
Manchmal sieht man den Wald vor lauter Bäumen nicht...
Thanks Sokra!
Most helpful comment
As you're using
scssfiles too: