cashier-ipad/vue.config.js

53 lines
1.5 KiB
JavaScript

// 将图片放入分包中,最后使用图片时 /分包名称/.../*/图片名称
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://192.168.1.42', // 目标服务器地址
changeOrigin: true, // 是否改变源地址
rewrite: '/' // 重写路径
},
"/ysk": {
"target": "http://192.168.1.42",
changeOrigin: true,
pathRewrite: {
"^/ysk": ""
}
}
}
},
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, '/')
}])
]
}
}