|
|
@ -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') |
|
|
|
} |
|
|
|