- 后端:腾讯 mkline 新增 /api/stock/history-minute(m1/m5/m15/m30/m60) - 新组件 kline-card.tsx:自包含周期/折线蜡烛/指标开关与K线数据加载, 切周期只重拉K线,不刷新页面其他模块 - 详情页瘦身为独立模块:K线图 / 今开最高最低昨收 / 每日行情明细互不耦合 - 时间统一按 UTC 解析传 Unix 秒,修复日线 invalid date/N/A 与分钟线时区问题 - 资金流向失败降级为非致命,不再导致整页报错 - vite 构建拆分 recharts/lightweight-charts/router 独立 chunk
65 lines
2.1 KiB
TypeScript
Executable File
65 lines
2.1 KiB
TypeScript
Executable File
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import viteReact from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
import tsConfigPaths from "vite-tsconfig-paths";
|
|
import { existsSync } from "fs";
|
|
import { resolve } from "path";
|
|
|
|
const SOURCE_LOCATION_PLUGIN_CANDIDATES = [
|
|
process.env.MEOO_SOURCE_LOCATION_PLUGIN_PATH,
|
|
"/app/sdk/lib/src/plugins/source-location-babel.js",
|
|
resolve(process.cwd(), "node_modules/@ali/oneday-agent-sdk/lib/src/plugins/source-location-babel.js"),
|
|
].filter(Boolean) as string[];
|
|
|
|
const SOURCE_LOCATION_PLUGIN_PATH = SOURCE_LOCATION_PLUGIN_CANDIDATES.find((path) => existsSync(path));
|
|
|
|
/**
|
|
* React + Vite 构建配置
|
|
*
|
|
* 硬约束:
|
|
* - dev server 必须监听 3015 + strictPort(沙箱只开放一个代理端口)
|
|
* - outDir 'dist' / assetsDir 'assets' — 归一化产物目录
|
|
*/
|
|
export default defineConfig({
|
|
plugins: [
|
|
tailwindcss(),
|
|
TanStackRouterVite(),
|
|
viteReact({
|
|
babel: {
|
|
plugins: SOURCE_LOCATION_PLUGIN_PATH
|
|
? [[SOURCE_LOCATION_PLUGIN_PATH, { projectRoot: process.cwd() }]]
|
|
: [],
|
|
},
|
|
}),
|
|
tsConfigPaths(),
|
|
],
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: 3015,
|
|
strictPort: true,
|
|
allowedHosts: true,
|
|
// HMR 默认关闭:沙筆预览 iframe 下 HMR 的整页 reload 会放大任何 transform error
|
|
// 如需热更,改为: hmr: { clientPort: 443, protocol: 'wss' }
|
|
hmr: false,
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
assetsDir: "assets",
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: "assets/[name]-[hash].js",
|
|
chunkFileNames: "assets/[name]-[hash].js",
|
|
assetFileNames: "assets/[name]-[hash][extname]",
|
|
manualChunks(id) {
|
|
// 把常用大库拆到独立 chunk,减少主 chunk 体积
|
|
if (id.includes("node_modules/recharts")) return "recharts";
|
|
if (id.includes("node_modules/lightweight-charts")) return "lightweight-charts";
|
|
if (id.includes("node_modules/@tanstack/react-router")) return "router";
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|