打包去log不生效处理

pull/755/head
zhangdaiscott 2023-08-24 22:49:12 +08:00
parent e687fa784f
commit e23d82dedb
3 changed files with 7 additions and 16 deletions

View File

@ -7,9 +7,6 @@ VITE_PUBLIC_PATH = /
# 跨域代理,您可以配置多个 ,请注意,没有换行符
VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
# 控制台不输出
VITE_DROP_CONSOLE = false
#后台接口父地址(必填)
VITE_GLOB_API_URL=/jeecgboot

View File

@ -4,9 +4,6 @@ VITE_USE_MOCK = true
# 发布路径
VITE_PUBLIC_PATH = /
# 控制台不输出
VITE_DROP_CONSOLE = true
# 是否启用gzip或brotli压缩
# 选项值: gzip | brotli | none
# 如果需要多个可以使用“,”分隔

View File

@ -27,7 +27,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
// The boolean type read by loadEnv is a string. This function can be converted to boolean type
const viteEnv = wrapperEnv(env);
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } = viteEnv;
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY } = viteEnv;
const isBuild = command === 'build';
@ -65,18 +65,15 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
target: 'es2015',
cssTarget: 'chrome80',
outDir: OUTPUT_DIR,
terserOptions: {
compress: {
keep_infinity: true,
// Used to delete console in production environment
drop_console: VITE_DROP_CONSOLE,
drop_debugger: true,
},
},
// Turning off brotliSize display can slightly reduce packaging time
// 关闭brotliSize显示可以稍微减少打包时间
reportCompressedSize: false,
// 提高超大静态资源警告大小
chunkSizeWarningLimit: 2000,
},
esbuild: {
//清除全局的console.log和debug
drop: isBuild ? ['console', 'debugger'] : [],
},
define: {
// setting vue-i18-next
// Suppress warning