Files
zPDF_package/vite.config.js
zikai f64cbfec31 feat: 新增组件独立部署支持(dev 代理 /api/pdf 到 zTools2)
vite.config.js 配 /api/pdf 与 /api/admin/pdf 代理到 127.0.0.1:6867,
独立 npm run dev(:5175) 时无需手工配跨域即可同源调用后端。
2026-07-27 13:52:32 +08:00

27 lines
735 B
JavaScript
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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// 便携式构建base './' 使产物可被任意路径托管(含 zTools2 /static 与 mainPage iframe
// preview 开放 f.zikai.wang 便于线上预览校验。
// dev 独立运行时,/api/pdf/* 经代理转发到 zTools2127.0.0.1:6867保持同源调用语义。
export default defineConfig({
plugins: [vue()],
base: './',
preview: {
allowedHosts: ['f.zikai.wang'],
},
server: {
port: 5175,
proxy: {
'/api/pdf': {
target: 'http://127.0.0.1:6867',
changeOrigin: true,
},
'/api/admin/pdf': {
target: 'http://127.0.0.1:6867',
changeOrigin: true,
},
},
},
})