added css minimizer to webpack

This commit is contained in:
zutto 2024-05-27 09:46:25 +03:00
parent 188806d1f8
commit 4ab75675f6
2 changed files with 8 additions and 0 deletions

View file

@ -12,6 +12,7 @@
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"mini-css-extract-plugin": "^2.9.0", "mini-css-extract-plugin": "^2.9.0",
"style-loader": "^4.0.0", "style-loader": "^4.0.0",
"webpack": "^5.91.0", "webpack": "^5.91.0",

View file

@ -1,5 +1,7 @@
const path = require('path'); const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
module.exports = { module.exports = {
entry: './src/js/app.js', entry: './src/js/app.js',
@ -15,6 +17,11 @@ module.exports = {
}, },
], ],
}, },
optimization: {
minimizer: [
new CssMinimizerPlugin(),
],
},
plugins: [ plugins: [
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: 'styles.css', filename: 'styles.css',