fix: 手动打包 Proxy 问题(#91)

* perf: 检查代码

* feat: proxy setting

* chore: 调整为测试环境使用 `proxy`
This commit is contained in:
Redon authored and GitHub committed 2023-02-22 14:29:05 +08:00
1 parent 66cecb6049
commit bf5c0cdf04
8 files changed
+28 -16

No files matched your search

+1
View File
@@ -0,0 +1 @@
export * from './proxy'
+16
View File
@@ -0,0 +1,16 @@
import type { ProxyOptions } from 'vite'
export function createViteProxy(isOpenProxy: boolean, viteEnv: ImportMetaEnv) {
if (!isOpenProxy)
return
const proxy: Record<string, string | ProxyOptions> = {
'/api': {
target: viteEnv.VITE_GLOB_API_URL,
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''),
},
}
return proxy
}