. 修复Vite配置以保留console日志
在 `vite.config.ts` 中进行了以下修改:
```
export default ({ mode }: ConfigEnv) =>
{
// 判断是否为生产环境
const isProduction = mode ===
'production';
return defineConfig({
// ... 其他配置
build: {
minify: 'terser',
outDir: ViteApp.VITE_OUTDIR,
terserOptions: {
// 根据环境决定是否移除console
compress: {
keep_infinity: true,
// 只在生产环境移除console,开发
和调试时保留
drop_console: false, // 改为
false以保留console日志
drop_debugger:
isProduction // 只在生产环境移除
debugger
}
},
// ...
}
});
};
```