Docker Build and Push / build-image (push) Successful in 2m37s
- 宏观只保留本地 新闻/经济文章, 外接 ifinance categories[] 动态成为 tab (纯前端直连, CORS/_headers, https) - 报警从宏观迁到监控第 4 个 tab (保留 Alert 模块, 供未来新增报警源) - 彻底删除油价/经济数据/策略研究: 前端组件+api、后端 apizero/data 路由、cron、fetchers、种子数据 - 新增迁移 DROP Indicator/IndicatorPoint/Strategy/OilPriceHistory; 重新生成 Prisma Client - CSP 放开 *.honor3.com (含端口通配), 避免新增子域反复重装外壳
54 lines
2.1 KiB
JavaScript
54 lines
2.1 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// 每次编译生成唯一 build 号 (YYYYMMDDHHmmss), 通过 define 注入到 __BUILD_ID__
|
|
// 版本号 APP_VERSION 唯一管理点在 package.json 的 version 字段 (手动修改)
|
|
function makeBuildId() {
|
|
// 统一用 UTC+8 (北京时间) 生成: CI runner 是 UTC 时区, 直接取本地时间会把日期/小时错位
|
|
const d = new Date(Date.now() + 8 * 3600 * 1000)
|
|
const p = (n, w) => String(n).padStart(w || 2, '0')
|
|
return `${d.getUTCFullYear()}${p(d.getUTCMonth() + 1)}${p(d.getUTCDate())}${p(d.getUTCHours())}${p(d.getUTCMinutes())}${p(d.getUTCSeconds())}`
|
|
}
|
|
const BUILD_ID = makeBuildId()
|
|
|
|
// 移动端优先: 默认按移动视口开发, 同时兼容桌面浏览器
|
|
// HMR 走 WebSocket; 某些受限 webview (VS Code Simple Browser / 老版 Android WebView) 不支持,
|
|
// 此时 Vite 会自动降级为整页刷新兜底 (full-reload 与 HMR 共用同一 WS 通道)。
|
|
// 注意: 不能设 hmr: false —— 那会连 WS 通道一起关掉, 文件变更不再触发任何刷新。
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
// PowerSync 的数据库/同步跑在 module worker 里, iife worker 不支持代码分包 (0.2.1)
|
|
worker: {
|
|
format: 'es',
|
|
},
|
|
define: {
|
|
__BUILD_ID__: JSON.stringify(BUILD_ID), // 构建时生成的唯一 build 号
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
hmr: true, // 开启 WebSocket HMR + full-reload 兜底
|
|
watch: {
|
|
usePolling: true, // Windows 文件监听用轮询更可靠
|
|
interval: 300,
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://127.0.0.1:3001',
|
|
changeOrigin: true,
|
|
},
|
|
// ifinance 外接模块 (开发期代理, 规避跨域; 生产环境前端直连)
|
|
'/ifinance-api': {
|
|
target: 'https://ifinance.honor3.com',
|
|
changeOrigin: true,
|
|
rewrite: (p) => p.replace(/^\/ifinance-api/, ''),
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
sourcemap: true,
|
|
},
|
|
})
|