主要改进: - 重构静态文件服务: 实现自定义 StaticFileHandler,完善 SPA 路由支持和 Content-Type 处理 - 优化 Docker 构建: 简化前端资源复制逻辑,直接复制整个 dist 目录 - 添加 K8s 部署配置: 包含健康检查探针、资源限制和服务配置 - 前端配置优化: Vite 使用相对路径 base,确保打包后资源路径正确 - 代码清理: 删除已废弃的数据迁移脚本 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: './', // 使用相对路径,确保打包后资源路径正确
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
javascriptEnabled: true,
|
|
// antd 主题定制 - 白色毛玻璃风格
|
|
modifyVars: {
|
|
'@primary-color': '#007aff', // macOS 蓝色
|
|
'@link-color': '#007aff', // 链接色
|
|
'@border-radius-base': '12px', // 组件圆角
|
|
'@layout-body-background': '#ffffff', // 白色背景
|
|
'@component-background': 'rgba(255, 255, 255, 0.8)', // 半透明组件背景
|
|
'@border-color-base': 'rgba(0, 0, 0, 0.06)', // 边框色
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
assetsDir: 'assets',
|
|
},
|
|
})
|