This commit is contained in:
六如
2024-11-25 00:18:47 +08:00
parent ba384660f1
commit 5e2c3fab46
37 changed files with 939 additions and 86 deletions

View File

@@ -24,7 +24,14 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
port: VITE_PORT,
host: "0.0.0.0",
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
proxy: {},
proxy: {
"/api": {
// 这里填写后端地址
target: "http://127.0.0.1:8082",
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, "")
}
},
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
warmup: {
clientFiles: ["./index.html", "./src/{views,components}/*"]