Browse Source

修改配置

master
yangzongjia 2 years ago
parent
commit
88622f506d
  1. 3
      .env.production
  2. 49
      vue.config.js

3
.env.production

@ -2,7 +2,8 @@
ENV = 'production'
# base api
VUE_APP_BASE_API = '/monitorapi'
# VUE_APP_BASE_API = '/monitorapi'
VUE_APP_BASE_API = '/api'
## 配置 正式接口地址
VUE_APP_URL = "http://120.46.131.15:8111"

49
vue.config.js

@ -24,7 +24,8 @@ module.exports = {
*在大多数情况下请使用/
*详细信息https://cli.vuejs.org/config/#publicpath
*/
publicPath: process.env.NODE_ENV === 'production' ? '/monitor/' : '/',
// publicPath: process.env.NODE_ENV === 'production' ? '/monitor/' : '/',
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
outputDir: 'monitor-ui',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',
@ -41,7 +42,7 @@ module.exports = {
proxy: {
'/api': { // 匹配所有以 '/api'开头的请求路径
// target: 'http://192.168.1.109:8111',
target: process.env.VUE_APP_URL, // 代理目标的基础路径
target: process.env.VUE_APP_URL, // 代理目标的基础路径
changeOrigin: true, // 支持跨域
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
'^/api': ''
@ -49,7 +50,7 @@ module.exports = {
},
'/upload': { // 匹配所有以 '/api'开头的请求路径
// target: 'http://120.46.131.15:8111',
target: process.env.VUE_APP_URL, // 代理目标的基础路径
target: process.env.VUE_APP_URL, // 代理目标的基础路径
changeOrigin: true, // 支持跨域
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
'^/upload': ''
@ -112,28 +113,28 @@ module.exports = {
.end()
config
.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
}
})
})
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
config.optimization.runtimeChunk('single')
}

Loading…
Cancel
Save