This commit is contained in:
2026-08-26 15:24:51 +08:00
parent 312519f1ab
commit ee83d87a85
8 changed files with 53 additions and 12 deletions
+17 -2
View File
@@ -1,8 +1,22 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
export default defineConfig({
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const domesticTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
const overseasTarget = env.OVERSEAS_API_PROXY_TARGET || 'http://127.0.0.1:9300'
return {
plugins: [uni()],
server: {
proxy: {
'/api': { target: domesticTarget, changeOrigin: true },
'/overseas-api': {
target: overseasTarget,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/overseas-api/, '/api')
}
}
},
css: {
preprocessorOptions: {
scss: {
@@ -18,4 +32,5 @@ export default defineConfig({
}
}
}
}
})