From 3667807a7b7418efc090ee3fa6a6b734bc3080bf Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Wed, 13 Sep 2023 20:36:29 +0800
Subject: [PATCH] Merge branch 'develop' of http://s16s652780.51mypc.cn:49896/r/yskj/iot_drone_web into develop

---
 vite.config.ts |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/vite.config.ts b/vite.config.ts
index 29c6933..b8b964a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -9,11 +9,15 @@
 import PkgConfig from 'vite-plugin-package-config'
 import viteSvgIcons from 'vite-plugin-svg-icons'
 import { viteVConsole } from 'vite-plugin-vconsole'
-
+import cesium from 'vite-plugin-cesium'
+// autoImport
+import AutoImport from 'unplugin-auto-import/vite'
+import { CURRENT_CONFIG } from './src/api/http/config'
 // https://vitejs.dev/config/
 export default ({ command, mode }: ConfigEnv): UserConfigExport => defineConfig({
   plugins: [
     vue(),
+    cesium(),
     eslintPlugin({
       fix: true
     }),
@@ -35,6 +39,17 @@
         theme: 'light'
       }
     }),
+    AutoImport({
+      dts: 'types/auto-imports.d.ts',
+      imports: ['vue', 'vue-router'],
+      // 解决eslint报错问题
+      eslintrc: {
+        // 这里先设置成true然后npm run dev 运行之后会生成 .eslintrc-auto-import.json 文件之后,在改为false
+        enabled: false,
+        filepath: './.eslintrc-auto-import.json', // 生成的文件路径
+        globalsPropValue: true,
+      },
+    }),
     PkgConfig(),
     OptimizationPersist()
     // [svgBuilder('./src/assets/icons/')] // All svg under src/icons/svg/ have been imported here, no need to import separately
@@ -42,7 +57,16 @@
   server: {
     open: true,
     host: '0.0.0.0',
-    port: 8080
+    port: 8080,
+    proxy: {
+      '/api': {
+        // 代理请求之后的请求地址(你的真实接口地址)
+        target: CURRENT_CONFIG.baseURL,
+        rewrite: path => path.replace(/^\/api/, ''),
+        // 跨域
+        changeOrigin: true
+      }
+    }
   },
   envDir: './env',
   resolve: {

--
Gitblit v1.9.3