Files
steven d7c9670880
CI / backend (push) Canceled after 0s
feat(design): 主色改靛蓝 #4F46E5,Web 与安卓及 Logo 同步
- primary 换成 Indigo 阶(600 即 #4F46E5),中性色转 Slate 轴、纸面更冷更白
- 实心主色面(主按钮、工作区选中)用 600,链接/浅底文字仍用 700 保对比度
- 信息色 sky 调深到 #16697C,与靛蓝同屏能分清
- Logo / favicon / PWA 图标 / 安卓自适应图标统一为靛蓝底 + 白线 + 淡紫点,tools/make-icons.py 重新生成
- 文档与 e2e 断言同步(主题色 #4f46e5)
2026-11-02 15:33:26 +08:00

81 lines
2.7 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
// 开发端口固定 5180,接口走代理,避免本地跨域配置漂移
export default defineConfig({
plugins: [
react(),
VitePWA({
// 有新版本时先不偷偷换掉:让用户自己点"刷新",
// 免得开着看板的时候后台把 chunk 换了,点一下就是 404。
registerType: "prompt",
injectRegister: null, // main.tsx 里自己注册,好在拿到 onNeedRefresh
includeAssets: ["icons/apple-touch-icon.png"],
manifest: {
name: "达道Task",
short_name: "达道Task",
description: "任务、工单、知识库,一条道走到底。",
lang: "zh-CN",
dir: "ltr",
start_url: "/",
scope: "/",
display: "standalone",
orientation: "any",
background_color: "#f4f5f9",
theme_color: "#4f46e5",
categories: ["productivity", "business"],
icons: [
{ src: "/icons/icon-192.png", sizes: "192x192", type: "image/png", purpose: "any" },
{ src: "/icons/icon-512.png", sizes: "512x512", type: "image/png", purpose: "any" },
{
src: "/icons/maskable-512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
workbox: {
// 只预缓存构建产物与图标;Vditor 那 3.7MB 运行时按需缓存,别拖慢首次安装
globPatterns: ["**/*.{js,css,html,svg,png,ico,woff2}"],
globIgnores: ["vditor/**", "**/*.map"],
navigateFallback: "/index.html",
navigateFallbackDenylist: [/^\/api\//],
cleanupOutdatedCaches: true,
runtimeCaching: [
{
// 接口一律走网络:离线时宁可报错,也不要把别人的旧数据端出来
urlPattern: ({ url }) => url.pathname.startsWith("/api/"),
handler: "NetworkOnly",
},
{
// 编辑器的 lute / 语言包 / 图标:用过一次就留着,离线也能写字
urlPattern: ({ url }) => url.pathname.startsWith("/vditor/"),
handler: "CacheFirst",
options: {
cacheName: "vditor",
expiration: { maxEntries: 40, maxAgeSeconds: 60 * 60 * 24 * 30 },
},
},
],
},
devOptions: { enabled: false },
}),
],
server: {
port: 5180,
strictPort: true,
proxy: {
"/api": {
target: process.env.VITE_API_TARGET ?? "http://127.0.0.1:8100",
changeOrigin: true,
},
},
},
build: {
outDir: "dist",
sourcemap: true,
},
});