From 65af4386c9eb413490c5e9817a10467ecb33ef69 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 24 十月 2023 10:38:04 +0800 Subject: [PATCH] 增加环境配置并配置打包命令 --- .env.development | 8 ++++++++ vue.config.js | 6 +++--- .env.preview | 12 ++++++++++++ package.json | 4 +++- .env | 18 ++++++++++++++++++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.env b/.env new file mode 100644 index 0000000..101017f --- /dev/null +++ b/.env @@ -0,0 +1,18 @@ +# 鎵�鏈夌幆澧冮粯璁� + +# 椤甸潰 title 鍓嶇紑 +VUE_APP_TITLE=Basic +NODE_ENV=development +VUE_APP_BATH_PATH='http://192.168.20.119:9083' +# 缃戠粶璇锋眰鍏敤鍦板潃 +VUE_APP_API=/api/ + +# 浠撳簱鍦板潃 +VUE_APP_REPO="" + +# 鍥介檯鍖栭厤缃� +VUE_APP_I18N_LOCALE=zh-chs +VUE_APP_I18N_FALLBACK_LOCALE=en + +# element 棰滆壊 +VUE_APP_ELEMENT_COLOR=#2A78FB diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..9073ccc --- /dev/null +++ b/.env.development @@ -0,0 +1,8 @@ +# 寮�鍙戠幆澧� +# 鎸囧畾鏋勫缓妯″紡 +NODE_ENV=development + +# 椤甸潰 title 鍓嶇紑 +VUE_APP_TITLE=Basic +VUE_APP_BATH_PATH='http://192.168.20.119:9083' + diff --git a/.env.preview b/.env.preview new file mode 100644 index 0000000..99ff596 --- /dev/null +++ b/.env.preview @@ -0,0 +1,12 @@ +# 鏋勫缓棰勮椤甸潰 + +# 鎸囧畾鏋勫缓妯″紡 +NODE_ENV=production + +# 鏍囪褰撳墠鏋勫缓鏂瑰紡 +VUE_APP_BUILD_MODE=PREVIEW +VUE_APP_BATH_PATH='http://www.fai365.com:9081 +VUE_APP_SCOURCE_LINK=TRUE + +# 閮ㄧ讲璺緞 +VUE_APP_PUBLIC_PATH=/ diff --git a/package.json b/package.json index 7eb0c2b..1925ac5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", - "lint": "vue-cli-service lint" + "lint": "vue-cli-service lint", + "build:preview": "NODE_OPTIONS=--max_old_space_size=4096 vue-cli-service build --mode preview", + "test:unit": "vue-cli-service test:unit" }, "dependencies": { "axios": "^1.4.0", diff --git a/vue.config.js b/vue.config.js index 670f28b..83bffdf 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ const path = require("path") // 鍩虹璺緞 娉ㄦ剰鍙戝竷涔嬪墠瑕佸厛淇敼杩欓噷 -const publicPath = "/" +const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/" function resolve(dir) { return path.join(__dirname, dir) } @@ -19,7 +19,7 @@ // target: "http://192.168.20.118:8002", ws: true, changeOrigin: true - }, + } } }, transpileDependencies: [ @@ -33,7 +33,7 @@ configNew.externals = externals configNew.plugins = [] } else if (process.env.NODE_ENV === "development") { - // console.log("development", config) + console.log("development", config) } return configNew }, -- Gitblit v1.8.0