vite.config.js 454 B

123456789101112131415161718
  1. import { defineConfig } from 'vite'
  2. import uni from '@dcloudio/vite-plugin-uni'
  3. // H5 dev: 通过 Vite 代理把 /api 转发到后端,避开浏览器 CORS。
  4. // 接入新后端时,把 API_TARGET 改成对应环境即可。
  5. const API_TARGET = 'http://aiot.zoomwin.com.cn:51001'
  6. export default defineConfig({
  7. plugins: [uni()],
  8. server: {
  9. proxy: {
  10. '/api': {
  11. target: API_TARGET,
  12. changeOrigin: true,
  13. },
  14. },
  15. },
  16. })