From b829d2cd05716241e09e2139d9adfe754b784bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Thu, 2 Sep 2021 11:18:49 +0800 Subject: [PATCH] =?UTF-8?q?seller=E7=BA=BF=E4=B8=8A=E5=88=A0=E9=99=A4conso?= =?UTF-8?q?le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seller/vue.config.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/seller/vue.config.js b/seller/vue.config.js index 978a04c0..7387d6e7 100644 --- a/seller/vue.config.js +++ b/seller/vue.config.js @@ -45,9 +45,26 @@ let 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 = enableCDN ? cdn : { css: [], js: [] }; externals = enableCDN ? externals : {}; +jsPlugin = enableProduction ? jsPlugin : []; module.exports = { css: { @@ -80,21 +97,7 @@ module.exports = { ], mode: "production", optimization: { - minimizer: [ - new UglifyJsPlugin({ - uglifyOptions: { - // 删除注释 - output: { - comments: false - }, - compress: { - drop_console: true, // 删除所有调式带有console的 - drop_debugger: true, - pure_funcs: ["console.log"] // 删除console.log - } - } - }) - ], + minimizer: jsPlugin, runtimeChunk: "single", splitChunks: { chunks: "all",