Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 10:59:21 +08:00

fix: debugger 语句在开发环境下不生效 (#170)

Co-authored-by: pany <939630029@qq.com>
This commit is contained in:
ClariS 2024-03-18 17:31:27 +08:00 committed by GitHub
parent 893ad57f7c
commit bf17c67fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,8 +9,8 @@ import svgLoader from "vite-svg-loader"
import UnoCSS from "unocss/vite"
/** 配置项文档https://cn.vitejs.dev/config */
export default (configEnv: ConfigEnv): UserConfigExport => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as ImportMetaEnv
export default ({ mode }: ConfigEnv): UserConfigExport => {
const viteEnv = loadEnv(mode, process.cwd()) as ImportMetaEnv
const { VITE_PUBLIC_PATH } = viteEnv
return {
/** 打包时根据实际情况修改 base */
@ -69,14 +69,17 @@ export default (configEnv: ConfigEnv): UserConfigExport => {
}
},
/** 混淆器 */
esbuild: {
/** 打包时移除 console.log */
pure: ["console.log"],
/** 打包时移除 debugger */
drop: ["debugger"],
/** 打包时移除所有注释 */
legalComments: "none"
},
esbuild:
mode === "development"
? undefined
: {
/** 打包时移除 console.log */
pure: ["console.log"],
/** 打包时移除 debugger */
drop: ["debugger"],
/** 打包时移除所有注释 */
legalComments: "none"
},
/** Vite 插件 */
plugins: [
vue(),