chore(config): 更新生产环境配置和构建设置

- 修复 .env.production 文件中的注释编码问题
- 移除路由守卫中的调试日志输出
- 调整错误处理机制,生产环境静默处理错误
- 移除应用挂载时的调试日志和异常处理包装
- 添加构建配置和基础路径设置
This commit is contained in:
2025-12-26 10:54:17 +08:00
parent 3662ee072b
commit e251153d14
4 changed files with 22 additions and 16 deletions

View File

@@ -1,7 +1,8 @@
# 鐢熶骇鐜閰嶇疆
# 鏈嶅姟鍣ㄥ湴鍧€: 175.178.252.59
# 生产环境配置
# 服务器地址: 175.178.252.59
# 鍚庣API鍦板潃
# 后端API地址
VITE_API_BASE_URL=http://175.178.252.59:8082/api
# PingPong妯″紡锛坰andbox/production锛塦nVITE_PINGPONG_MODE=sandbox
# PingPong模式sandbox/production`nVITE_PINGPONG_MODE=sandbox

View File

@@ -17,18 +17,14 @@ app.use(router)
app.use(ElementPlus)
app.use(i18n)
// 添加错误处理
// 添加错误处理(生产环境静默处理)
app.config.errorHandler = (err, instance, info) => {
console.error('Vue错误:', err)
console.error('错误信息:', info)
console.error('组件实例:', instance)
// 生产环境可以记录到错误追踪服务
if (import.meta.env.DEV) {
console.error('Vue错误:', err, info)
}
}
// 挂载应用
try {
app.mount('#app')
console.log('Vue应用已成功挂载')
} catch (error) {
console.error('应用挂载失败:', error)
}
app.mount('#app')

View File

@@ -111,8 +111,6 @@ const router = createRouter({
// 路由守卫
router.beforeEach((to, from, next) => {
console.log('路由导航:', from.path, '->', to.path)
// 检查是否需要认证
if (to.meta.requiresAuth) {
// 检查是否已登录

View File

@@ -12,6 +12,17 @@ export default defineConfig({
'@': path.resolve(__dirname, 'src')
}
},
// 构建配置
build: {
outDir: 'dist',
assetsDir: 'assets',
// 确保资源路径正确
assetsInlineLimit: 4096,
// 生成source map生产环境可以关闭
sourcemap: false
},
// 基础路径(如果部署在子目录下需要配置)
base: '/',
server: {
port: 3000,
proxy: {