f
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { loadEnv } from 'vite'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import Components from '@uni-helper/vite-plugin-uni-components'
|
||||
@@ -14,19 +15,21 @@ import { UniEcharts } from 'uni-echarts/vite'
|
||||
import Uni from '@uni-helper/plugin-uni'
|
||||
import UnoCSS from 'unocss/vite'
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 5173,
|
||||
strictPort: false,
|
||||
// 与 tyc-webview-v2 一致:H5 开发时将 /api/v1 代理到线上网关(本地可改 target)
|
||||
proxy: {
|
||||
'/api/v1': {
|
||||
// target: 'https://www.tianyuancha.cn',
|
||||
target: 'http://127.0.0.1:8888',
|
||||
changeOrigin: true,
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const proxyTarget = env.VITE_API_PROXY_TARGET || env.VITE_API_BASE_URL?.replace(/\/api\/v1$/, '') || 'https://www.quannengcha.com'
|
||||
return {
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 5678,
|
||||
strictPort: true,
|
||||
proxy: {
|
||||
"/api/v1": {
|
||||
target: proxyTarget,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
@@ -66,7 +69,8 @@ export default defineConfig({
|
||||
"vue-demi",
|
||||
"uni-echarts"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user