更新项目配置,添加 terser 作为压缩工具,修改 Vite 配置以支持生产环境构建,调整 API 基础地址为实际域名,并优化登录页面和游戏页面的状态管理逻辑。

This commit is contained in:
zyh
2025-08-27 18:29:50 +08:00
parent abde5d1f9d
commit 1c08651831
8 changed files with 173 additions and 29 deletions

View File

@@ -8,10 +8,18 @@ export default defineConfig({
resolve: {
alias: { '@': path.resolve(__dirname, 'src') },
},
// 生产环境构建配置
build: {
outDir: 'dist',
assetsDir: 'assets',
sourcemap: false, // 生产环境不生成sourcemap
minify: 'terser', // 使用terser压缩
},
// 开发服务器配置(仅开发环境生效)
server: {
proxy: {
'/api': {
target: 'http://localhost:18080',
target: 'http://192.140.164.137:18080',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},