refactor(对接wcs): 配置修改

This commit is contained in:
Kelvin 2024-11-27 10:35:22 +08:00
parent cfb8ce96a7
commit 83e9c5bdc2
2 changed files with 37 additions and 29 deletions

View File

@ -22,7 +22,7 @@ const service = axios.create({
const serviceWcs = axios.create({ const serviceWcs = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分 // axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: "http://192.168.8.60:1880", baseURL: "/wcs",
// 超时 // 超时
timeout: 30000 timeout: 30000
}) })

View File

@ -43,19 +43,27 @@ module.exports = {
}, },
'/ureport': { '/ureport': {
target: 'http://localhost:8080', target: 'http://localhost:8080',
ws:false, ws: false,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/ureport': '/ureport' '^/ureport': '/ureport'
} }
}, },
'/wcs': {
target: 'http://192.168.8.60:1880',
ws: false,
changeOrigin: true,
pathRewrite: {
'^/wcs': ''
}
},
}, },
disableHostCheck: true disableHostCheck: true
}, },
css: { css: {
loaderOptions: { loaderOptions: {
sass: { sass: {
sassOptions: { outputStyle: "expanded" } sassOptions: {outputStyle: "expanded"}
} }
} }
}, },
@ -104,39 +112,39 @@ module.exports = {
.plugin('ScriptExtHtmlWebpackPlugin') .plugin('ScriptExtHtmlWebpackPlugin')
.after('html') .after('html')
.use('script-ext-html-webpack-plugin', [{ .use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime` // `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/
}]) }])
.end() .end()
config config
.optimization.splitChunks({ .optimization.splitChunks({
chunks: 'all', chunks: 'all',
cacheGroups: { cacheGroups: {
libs: { libs: {
name: 'chunk-libs', name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: 'initial' // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package 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 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 test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
}, },
commons: { commons: {
name: 'chunk-commons', name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true
}
} }
}) }
})
config.optimization.runtimeChunk('single'), config.optimization.runtimeChunk('single'),
{ {
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件 from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下 to: './' //到根目录下
} }
} }
) )
} }