| 12345678910111213141516171819202122232425262728 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- // 观澜前端构建配置(P11,用户令 2026-09-29)
- // · 产物落 `release/web/`:与现有静态件同住 release/,由后端/网关按同一前缀伺服;
- // · base './' —— 页面在网关子路径(/web/ 或 /detail/)下也要能取到自己的资源;
- // · 开发期代理:把 /api、/algorithm 转给现有 Python 后端与算法服务(真源仍在契约里)。
- export default defineConfig({
- plugins: [vue()],
- base: '/web/',
- resolve: {
- alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
- },
- build: {
- outDir: fileURLToPath(new URL('../../release/web', import.meta.url)),
- emptyOutDir: true,
- sourcemap: false,
- target: 'es2020',
- },
- server: {
- port: 28110,
- proxy: {
- '/api': { target: 'http://127.0.0.1:18033', changeOrigin: true },
- '/algorithm': { target: 'http://127.0.0.1:18050', changeOrigin: true, rewrite: (p) => p.replace(/^\/algorithm/, '') },
- },
- },
- })
|