first
This commit is contained in:
46
vue.config.js
Normal file
46
vue.config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// 将图片放入分包中,最后使用图片时 /分包名称/.../*/图片名称
|
||||
|
||||
const path = require('path')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
// devServer: {
|
||||
// proxy: {
|
||||
// '/shopApi': {
|
||||
// target: 'https://wxcashiertest.sxczgkj.cn/cashierService',
|
||||
// changeOrigin: true,
|
||||
// pathRewrite: {
|
||||
// '^/shopApi': ''
|
||||
// },
|
||||
// bypass(req, res, options) {
|
||||
// const proxyURL = options.target + options.rewrite(req.url);
|
||||
// req.headers['x-req-proxyURL'] = proxyURL; // 设置未生效
|
||||
// res.setHeader('x-req-proxyURL', proxyURL); // 设置响应头可以看到
|
||||
// },
|
||||
// onProxyRes(proxyRes, req, res) {
|
||||
// const realUrl = process.env.BASEURL + req.url || ''; // 真实请求网址
|
||||
// console.log(realUrl); // 在终端显示
|
||||
// proxyRes.headers['A-Real-Url'] = realUrl; // 添加响应标头(A-Real-Url为自定义命名),在浏览器中显示
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
devServer: {
|
||||
proxy: {
|
||||
'/server3': {
|
||||
target: 'http://101.37.12.135:8080', // 目标服务器地址
|
||||
changeOrigin: true, // 是否改变源地址
|
||||
rewrite: '/' // 重写路径
|
||||
}
|
||||
}
|
||||
},
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([{
|
||||
from: path.join(__dirname, '/static'),
|
||||
to: path.join(__dirname + '/unpackage/', 'dist', process.env.NODE_ENV === 'production' ?
|
||||
'build' : 'dev', process.env.UNI_PLATFORM, '/')
|
||||
}])
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user