This commit is contained in:
Mrx
2026-05-21 17:05:09 +08:00
parent 6137c69034
commit d18feb3090
18 changed files with 577 additions and 544 deletions

View File

@@ -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"
]
}
}
}
})