From b65c3f7f4b0ba142f44f3ae1699efb7116d49624 Mon Sep 17 00:00:00 2001 From: LCJ-MinYa <1049468118@qq.com> Date: Wed, 15 Oct 2025 11:50:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=BF=9D=E7=95=99console=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/plugins.ts | 2 +- vite.config.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build/plugins.ts b/build/plugins.ts index 7d2aa69..3818155 100644 --- a/build/plugins.ts +++ b/build/plugins.ts @@ -51,7 +51,7 @@ export function getPluginsList(VITE_CDN: boolean, VITE_COMPRESSION: ViteCompress VITE_CDN ? cdn : null, configCompressPlugin(VITE_COMPRESSION), // 线上环境删除console - removeConsole({ external: ['src/assets/iconfont/iconfont.js'] }), + // removeConsole({ external: ['src/assets/iconfont/iconfont.js'] }), // 打包分析 lifecycle === 'report' ? visualizer({ open: true, brotliSize: true, filename: 'report.html' }) : (null as any), // 移动src下的md文件到public/md目录 diff --git a/vite.config.ts b/vite.config.ts index c79b2ec..fd7587d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -31,6 +31,10 @@ export default ({ mode }: ConfigEnv): UserConfigExport => { include, exclude, }, + // 生产环境保留console(drop数组只有两个选项console和debugger,填入哪个值就代表生产环境去掉哪个) + esbuild: { + drop: ['debugger'], + }, build: { // https://cn.vitejs.dev/guide/build.html#browser-compatibility target: 'es2015',