Files
photo-live/apps/viewer/vite.config.ts
T
浅念 f9cb72ed06 feat(viewer): vite vue3 scaffold with routing and i18n
- apps/viewer (@photo/viewer): Vite 5 + Vue 3.4 + TS 最小骨架(无 Pinia/UI 库)
- router: /a/:token 活动页 + /a/:token/p/:photoId 单图深链(复用活动页组件)
- i18n: vue-i18n 9,zh-CN/en 词条,localStorage(viewer.locale) 持久 +
  navigator.language 检测兜底 zh-CN;顶栏语言切换组件;文案全量走 i18n
- api client: 类型化 fetch 封装(契约生成类型直连),错误信封 → ApiError,
  错误码 → i18n key 映射表(src/api/errors.ts)
- scripts: dev/build/preview/test(vitest 10 例)/test:e2e(Playwright 冒烟,
  webServer 自拉 dev)/lint/vue-tsc 全部接入 turbo
- root: +@playwright/test、+eslint-plugin-vue(flat config 收敛到 apps/**/*.vue)、
  pnpm.onlyBuiltDependencies 放行 esbuild

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-18 09:12:45 +08:00

24 lines
794 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vitest/config';
// dev server 固定 5173(CORS_ORIGINS 已包含);/v1 代理仅作用于 `vite dev`,
// build/preview 不经此处——生产由网关同源挂载 /v1。
// host 显式 127.0.0.1:Windows 下 localhost 默认可能只绑 [::1],代理/e2e 探活走 IPv4。
export default defineConfig({
plugins: [vue()],
server: {
host: '127.0.0.1',
port: 5173,
strictPort: true,
proxy: {
'/v1': { target: 'http://127.0.0.1:8080', changeOrigin: true },
},
},
preview: { host: '127.0.0.1', port: 5173, strictPort: true },
test: {
environment: 'jsdom',
// 仅收集组件/单元测试;e2e/ 归 Playwright(test:e2e)
include: ['src/**/*.{test,spec}.ts'],
},
});