This commit is contained in:
2026-08-25 20:52:11 +08:00
parent 6572771227
commit 69f8fdfcdb
4 changed files with 40 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const proxyTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
return {
plugins: [uni()],
server: {
proxy: {
'/api': {
target: proxyTarget,
changeOrigin: true,
configure(proxy) {
proxy.on('proxyReq', (proxyRequest) => {
proxyRequest.removeHeader('origin')
})
}
}
}
}
}
})