删除部分manager不用的图片,压缩图片大小,修改统计时测出的bug

This commit is contained in:
lemon橪
2021-09-02 11:17:11 +08:00
parent 71e4c49c3e
commit 7f46528086
37 changed files with 56 additions and 100 deletions

View File

@@ -1,6 +1,6 @@
const path = require("path");
const CompressionPlugin = require("compression-webpack-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const resolve = dir => {
return path.join(__dirname, dir);
};
@@ -47,9 +47,27 @@ let cdn = {
]
};
// 判断是否需要加载CDN
// 删除注释
let jsPlugin = [
new UglifyJsPlugin({
uglifyOptions: {
// 删除注释
output: {
comments: false
},
compress: {
drop_console: true, // 删除所有调式带有console的
drop_debugger: true,
pure_funcs: ["console.log"] // 删除console.log
}
}
})
];
// 判断是否需要加载CDN线上删除注释
cdn = enableProduction ? cdn : { css: [], js: [] };
externals = enableProduction ? externals : {};
jsPlugin = enableProduction ? jsPlugin : [];
module.exports = {
css: {
loaderOptions: {
@@ -79,24 +97,9 @@ module.exports = {
threshold: 10240 // 对超过10k文件压缩
})
],
mode: "production",
optimization: {
runtimeChunk: "single",
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
// 删除注释
output: {
comments: false
},
compress: {
drop_console: true, // 删除所有调式带有console的
drop_debugger: true,
pure_funcs: ["console.log"] // 删除console.log
}
}
})
],
minimizer: jsPlugin,
splitChunks: {
chunks: "all",
maxInitialRequests: Infinity,