mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
chore: webpack: add css minification
This commit is contained in:
parent
e969b3c2b3
commit
3438a0c6a1
2 changed files with 17 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
|||
import {env} from 'node:process';
|
||||
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
const clean = (a) => a.filter(Boolean);
|
||||
|
||||
const plugins = clean([
|
||||
|
|
@ -22,8 +25,21 @@ const rules = [{
|
|||
}];
|
||||
|
||||
export default {
|
||||
mode: isDev ? 'development' : 'production',
|
||||
plugins,
|
||||
module: {
|
||||
rules,
|
||||
},
|
||||
optimization: {
|
||||
minimize: !isDev,
|
||||
minimizer: [
|
||||
new CssMinimizerPlugin({
|
||||
minimizerOptions: {
|
||||
preset: ['default', {
|
||||
svgo: false,
|
||||
}],
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@
|
|||
"clean-css-loader": "^4.2.1",
|
||||
"codegen.macro": "^4.0.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"css-minimizer-webpack-plugin": "^7.0.4",
|
||||
"css-modules-require-hook": "^4.2.3",
|
||||
"cssnano-preset-default": "^7.0.10",
|
||||
"domtokenlist-shim": "^1.2.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue