From c5c6fa800cedd37cea0e3cc3e68df78b47ee2813 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 28 八月 2023 10:37:59 +0800
Subject: [PATCH] 111

---
 screen_standard/vite.config.js |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/screen_standard/vite.config.js b/screen_standard/vite.config.js
index fd10edf..bf4e9bc 100644
--- a/screen_standard/vite.config.js
+++ b/screen_standard/vite.config.js
@@ -11,8 +11,12 @@
 // https://vitejs.dev/config/
 export default defineConfig(({mode, command}) => {
   let env = loadEnv(mode, process.cwd(), '')
-  console.log(env.NODE_ENV);
+  // console.log('-------');
+  // console.log(env.VITE_BASE_PATH);
+  // console.log(env.VITE_BASE_PATH.replace(env.VITE_BASE_PATH, ''));
+  // console.log('-------');
   return {
+    base:env.VITE_BASE_CONTEXT,
     plugins: [
       vue(),
       vueJsx(),
@@ -38,15 +42,18 @@
   
     // 鏈湴杩愯閰嶇疆锛屽強鍙嶅悜浠g悊閰嶇疆
     server: {
+      host: '192.168.0.3',
+      port: '8080',
       cors: true, // 榛樿鍚敤骞跺厑璁镐换浣曟簮
       open: true, // 鍦ㄦ湇鍔″櫒鍚姩鏃惰嚜鍔ㄥ湪娴忚鍣ㄤ腑鎵撳紑搴旂敤绋嬪簭
       //鍙嶅悜浠g悊閰嶇疆锛屾敞鎰弐ewrite鍐欐硶锛屽紑濮嬫病鐪嬫枃妗e湪杩欓噷韪╀簡鍧�
       proxy: {  // 鏈湴寮�鍙戠幆澧冮�氳繃浠g悊瀹炵幇璺ㄥ煙锛岀敓浜х幆澧冧娇鐢� nginx 杞彂
-        '/api': {
+        [env.VITE_BASE_PATH] : {
           target: env.VITE_BASE_URL, // 閫氳繃浠g悊鎺ュ彛璁块棶瀹為檯鍦板潃銆傝繖閲屾槸瀹為檯璁块棶鐨勫湴鍧�銆倂ue浼氶�氳繃浠g悊鏈嶅姟鍣ㄦ潵浠g悊璇锋眰
           changeOrigin: true,
           ws: false,  // 鍏佽websocket浠g悊
-          rewrite: (path) => path.replace(/^\/api/, '') // 灏哸pi鏇挎崲涓虹┖
+          secure: false,
+          rewrite: (path) => path.replace(env.VITE_BASE_PATH, '/')
         }
       }
     }

--
Gitblit v1.9.3