This commit is contained in:
2026-11-05 14:53:57 +08:00
parent 173bbe2d02
commit cc280338f1
5 changed files with 317 additions and 16 deletions
+5 -1
View File
@@ -1,5 +1,8 @@
import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { fileURLToPath } from 'node:url'
const projectDir = fileURLToPath(new URL('.', import.meta.url))
function loggedProxy(name, options) {
return {
@@ -24,9 +27,10 @@ function loggedProxy(name, options) {
}
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const env = loadEnv(mode, projectDir, '')
const apiTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
return {
envDir: projectDir,
base: process.env.UNI_PLATFORM === 'h5' && mode === 'production' ? '/' : undefined,
plugins: [uni()],
define: {