环境变量配置

This commit is contained in:
白菜
2025-11-12 10:57:07 +08:00
parent 87cd27b798
commit bc5f2b4470
4 changed files with 36 additions and 27 deletions

View File

@ -1,15 +1,15 @@
# 页面标题
VUE_APP_TITLE = 上动新能源-EMS管理系统
# 开发环境配置
ENV = 'development'
NODE_ENV = development
# EMS管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 开发环境配置
NODE_ENV = 'development'
# EMS管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
# EMS管理系统/开发环境 图片拼接地址
VUE_APP_IMG_URL = '/dev-api'
VUE_APP_IMG_URL = '/dev-api'

View File

@ -2,11 +2,11 @@
VUE_APP_TITLE = 上动新能源-EMS管理系统
# 生产环境配置
ENV = 'production'
NODE_ENV = production
NODE_ENV = 'production'
# EMS管理系统/生产环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API= 'http://1.15.120.242:8089'
# EMS管理系统/生产环境 图片拼接地址
VUE_APP_IMG_URL = 'http://1.15.120.242:8089
VUE_APP_IMG_URL = 'http://1.15.120.242:8089'

View File

@ -2,8 +2,11 @@
VUE_APP_TITLE = 上动新能源-EMS管理系统
# 测试环境配置
ENV = 'staging'
NODE_ENV = staging
NODE_ENV = 'staging'
# EMS管理系统/测试环境
VUE_APP_BASE_API= 'http://110.40.171.179:8089'
# EMS管理系统/测试环境 图片拼接地址
VUE_APP_IMG_URL = 'http://110.40.171.179:8089'
# EMS管理系统/生产环境 图片拼接地址
VUE_APP_IMG_URL = 'http://110.40.171.179:8089'

View File

@ -9,8 +9,6 @@ const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || 'EMS管理系统' // 网页标题
const baseUrl = 'http://110.40.171.179:8089' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口
// vue.config.js 配置说明
@ -34,19 +32,27 @@ module.exports = {
port: port,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: baseUrl,
// // detail: https://cli.vuejs.org/config/#devserver-proxy
// [process.env.VUE_APP_BASE_API]: {
// target: baseUrl,
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
// },
// // springdoc proxy
// '^/v3/api-docs/(.*)': {
// target: baseUrl,
// changeOrigin: true
// }
// 当请求前缀是/dev-api时,使用下面的代理
'/dev-api': {
target: 'http://110.40.171.179:8089',
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
'^/dev-api': ''
}
},
// springdoc proxy
'^/v3/api-docs/(.*)': {
target: baseUrl,
changeOrigin: true
}
},
disableHostCheck: true
},