当先锋百科网

首页 1 2 3 4 5 6 7
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");

module.exports = {
    optimization: {// 优化
        minimize: true,
        minimizer: [
            new CssMinimizerPlugin(),//压缩css
            new TerserPlugin({// 压缩 js
                terserOptions: {
                    format: {
                        comments: false,
                    },
                },
                extractComments: false,
            }),
        ],
    }
}