Files
2026-09-18 18:54:54 +08:00

27 lines
830 B
JavaScript
Raw Permalink 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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 构建产物直接写入 Go 网关的嵌入静态目录(go:embed all:web/static
export default defineConfig({
plugins: [vue()],
build: {
outDir: '../web/static',
// 不自动清空产物目录:自动清空会与系统安全删除机制冲突导致构建失败,
// 需要重新完整构建时手动执行 rm -rf ../web/static 后再 build。
emptyOutDir: false
},
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:8890',
changeOrigin: true
},
// 附件静态文件(PDF/图片预览):与 API 同源,避免开发态下 /uploads 打到 Vite 而 404
'/uploads': {
target: 'http://localhost:8890',
changeOrigin: true
}
}
}
})