From c9f65e26c5bcdeda18a2bd3dff8d92e0718a3f8b Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Mon, 30 Mar 2026 15:00:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f/web-kboss/vue.config.js | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/f/web-kboss/vue.config.js b/f/web-kboss/vue.config.js index 4dd53bd..51caab2 100644 --- a/f/web-kboss/vue.config.js +++ b/f/web-kboss/vue.config.js @@ -76,31 +76,31 @@ module.exports = { } }, // 生产环境去除console和debugger - // optimization: { - // minimizer: [ - // { - // apply: (compiler) => { - // // 只在生产环境生效 - // if (process.env.NODE_ENV === 'production') { - // const TerserPlugin = require('terser-webpack-plugin') - // new TerserPlugin({ - // terserOptions: { - // compress: { - // drop_console: true, // 移除console - // drop_debugger: true, // 移除debugger - // pure_funcs: ['console.log', 'console.info', 'console.warn', 'console.error'] // 移除特定的console方法 - // }, - // mangle: true, // 代码混淆 - // output: { - // comments: false // 移除注释 - // } - // } - // }).apply(compiler) - // } - // } - // } - // ] - // } + optimization: { + minimizer: [ + { + apply: (compiler) => { + // 只在生产环境生效 + if (process.env.NODE_ENV === 'production') { + const TerserPlugin = require('terser-webpack-plugin') + new TerserPlugin({ + terserOptions: { + compress: { + drop_console: true, // 移除console + drop_debugger: true, // 移除debugger + pure_funcs: ['console.log', 'console.info', 'console.warn', 'console.error'] // 移除特定的console方法 + }, + mangle: true, // 代码混淆 + output: { + comments: false // 移除注释 + } + } + }).apply(compiler) + } + } + } + ] + } }, chainWebpack(config) { // it can improve the speed of the first screen, it is recommended to turn on preload -- 2.34.1