From d7606a9a3c81114f5d255c72d0eeb55e87d8aabb Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 02 四月 2026 16:35:07 +0800
Subject: [PATCH] fix: 打包配置

---
 vue.config.js |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/vue.config.js b/vue.config.js
index 7c67ff3..6040103 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,6 +1,9 @@
 "use strict";
 const path = require("path");
 const defaultSettings = require("./src/settings.js");
+// 浠g悊鐩爣鍦板潃锛堝悗绔湇鍔★級锛屼緥濡�: http://172.17.0.1:8080
+// 鍚姩鏃跺彲閫氳繃鐜鍙橀噺瑕嗙洊锛歏UE_APP_PROXY_TARGET=...
+const baseUrl = process.env.VUE_APP_PROXY_TARGET || "http://1.15.17.182/:9031";
 
 function resolve(dir) {
   return path.join(__dirname, dir);
@@ -13,7 +16,8 @@
 // For example, Mac: sudo npm run
 // You can change the port by the following method:
 // port = 9527 npm run dev OR npm run dev --port = 9527
-const port = process.env.port || process.env.npm_config_port || 9527; // dev port
+// 鍥哄畾寮�鍙戞湇鍔$鍙o細纭繚澶栭儴鍙闂� `172.17.0.1:9031`
+const port = 9001; // dev port
 
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
@@ -34,18 +38,29 @@
   publicPath: "/",
   outputDir: "dist",
   assetsDir: "static",
-  lintOnSave: process.env.NODE_ENV === "development",
+  // 鍦ㄩ儴鍒嗙幆澧冧笅 eslint-loader 浼氬洜閰嶇疆瑙f瀽澶辫触鐩存帴瀵艰嚧鏋勫缓涓柇
+  // 杩欓噷鍏堝叧闂紝纭繚椤圭洰鍙互姝e父杩愯锛涗綘鍚庣画鍐嶈ˉ榻� eslint 瑙勫垯鍗冲彲銆�
+  lintOnSave: false,
   productionSourceMap: false,
   devServer: {
+    // 璁╁閮紙渚嬪 172.17.0.1锛夎兘璁块棶寮�鍙戞湇鍔�
     port: port,
-    open: true,
+    open: false,
     overlay: {
       warnings: false,
       errors: true,
     },
-    
+    // 鏈湴浠g悊锛氬姣� Vite 鐨� proxy 閰嶇疆鎬濊矾锛屼娇鐢� vue-cli 鐨� proxy
+    // 鐢变簬鏈」鐩帴鍙d富瑕佷互 /api 寮�澶达紝杩欓噷鍚屾椂浠g悊 /api 涓� /dev-api銆�
+    proxy: {
+      // 椤圭洰瀹為檯璇锋眰涓�鑸槸 /api/...锛岃繖閲岀洿鎺ヨ浆鍙戝苟淇濇寔 /api 鍓嶇紑涓嶅彉
+      "^/api": {
+        target: baseUrl,
+        changeOrigin: true,
+      },
+    },
   },
-  
+
   configureWebpack: {
     // provide the app's title in webpack's name field, so that
     // it can be accessed in index.html to inject the correct title.
@@ -63,7 +78,10 @@
     config.plugins.delete("prefetch"); // TODO: need test
 
     // set svg-sprite-loader
-    config.module.rule("svg").exclude.add(resolve("src/icons")).end();
+    config.module
+      .rule("svg")
+      .exclude.add(resolve("src/icons"))
+      .end();
     config.module
       .rule("icons")
       .test(/\.svg$/)

--
Gitblit v1.9.3