- packages/api-client:从 openapi.yaml 生成类型;cookie + CSRF / Bearer 两种鉴权、 分片上传、fetch 读事件流(API2) - apps/web:Vue 3 + Vite + TanStack Query,样式只来自 tokens.css / components.css(AR10); 扣点说明放在「开始解析」旁边(红线 9);接口地址、路由方式运行时可配(架构 §5.2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
||
import vue from "@vitejs/plugin-vue";
|
||
import { defineConfig } from "vite";
|
||
|
||
/**
|
||
* 开发:Vite 跑在 127.0.0.1:5173,把 /api 代理到后端 127.0.0.1:8009,网页版同源、cookie 直接可用。
|
||
* 构建:资源基础路径默认 "/";桌面外壳(file:// 或自定义协议)构建时设 VITE_BASE=./,
|
||
* 同时在 public/config.js 里把 routerMode 改成 "hash"(架构 §5.2 第 6 条)。
|
||
*/
|
||
export default defineConfig({
|
||
base: process.env.VITE_BASE ?? "/",
|
||
plugins: [vue()],
|
||
resolve: {
|
||
alias: {
|
||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||
// 设计规范是唯一的样式来源:tokens.css、components.css、logo 直接从 docs/design 引用,不复制
|
||
"@design": fileURLToPath(new URL("../../docs/design", import.meta.url)),
|
||
},
|
||
},
|
||
server: {
|
||
host: "127.0.0.1",
|
||
port: 5173,
|
||
strictPort: true,
|
||
proxy: {
|
||
"/api": { target: "http://127.0.0.1:8009", changeOrigin: false },
|
||
},
|
||
},
|
||
preview: { host: "127.0.0.1", port: 4173 },
|
||
});
|