webman-buildadmin框架优化
This commit is contained in:
@@ -11,7 +11,7 @@ const pathResolve = (dir: string): any => {
|
||||
|
||||
// https://vitejs.cn/config/
|
||||
const viteConfig = ({ mode }: ConfigEnv): UserConfig => {
|
||||
const { VITE_PORT, VITE_OPEN, VITE_BASE_PATH, VITE_OUT_DIR } = loadEnv(mode, process.cwd())
|
||||
const { VITE_PORT, VITE_OPEN, VITE_BASE_PATH, VITE_OUT_DIR, VITE_PROXY_TARGET } = loadEnv(mode, process.cwd())
|
||||
|
||||
const alias: Record<string, string> = {
|
||||
'/@': pathResolve('./src/'),
|
||||
@@ -29,9 +29,9 @@ const viteConfig = ({ mode }: ConfigEnv): UserConfig => {
|
||||
open: VITE_OPEN != 'false',
|
||||
// 开发时把 /api、/admin、/install 代理到 webman,避免跨域
|
||||
proxy: {
|
||||
'/api': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
'/admin': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
'/install': { target: 'http://localhost:8787', changeOrigin: true },
|
||||
'/api': { target: VITE_PROXY_TARGET || 'http://localhost:6969', changeOrigin: true },
|
||||
'/admin': { target: VITE_PROXY_TARGET || 'http://localhost:6969', changeOrigin: true },
|
||||
'/install': { target: VITE_PROXY_TARGET || 'http://localhost:6969', changeOrigin: true },
|
||||
},
|
||||
},
|
||||
build: {
|
||||
|
||||
Reference in New Issue
Block a user