chore: add CssMinimizerPlugin

This commit is contained in:
afc163 2020-08-12 20:33:26 +08:00
parent 9c91b62625
commit 043901468a
2 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,7 @@
"compile": "antd-tools run compile",
"compile:less": "antd-tools run compile:less",
"changelog": "node ./scripts/print-changelog",
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && cp -r .circleci/ .github/ _site && npm run site:test",
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && cp -r .circleci _site && npm run site:test",
"deploy": "bisheng gh-pages --push-only --dotfiles",
"deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages",
"dist": "antd-tools run dist",
@ -187,6 +187,7 @@
"cheerio": "^1.0.0-rc.3",
"concurrently": "^5.0.2",
"cross-env": "^7.0.0",
"css-minimizer-webpack-plugin": "^1.1.1",
"css-split-webpack-plugin": "^0.2.6",
"dekko": "^0.2.1",
"docsearch.js": "^2.6.3",

View File

@ -1,6 +1,7 @@
const path = require('path');
const replaceLib = require('@ant-design/tools/lib/replaceLib');
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const EsbuildPlugin = require('esbuild-webpack-plugin').default;
const { version } = require('../package.json');
const themeConfig = require('./themeConfig');
@ -89,7 +90,7 @@ module.exports = {
config.resolve.alias = { ...config.resolve.alias, react: require.resolve('react') };
} else if (process.env.ESBUILD) {
// use esbuild
config.optimization.minimizer = [new EsbuildPlugin()];
config.optimization.minimizer = [new EsbuildPlugin(), new CssMinimizerPlugin()];
}
alertBabelConfig(config.module.rules);