46 lines
1.2 KiB
JavaScript
46 lines
1.2 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: {
|
|
port:'80',
|
|
proxy: {
|
|
"/api": {
|
|
// 需要被代理的后台地址
|
|
"target": "https://cashier-client.sxczgkj.cn/cashier-client",
|
|
"changeOrigin": true,
|
|
"secure": false,
|
|
"pathRewrite": {
|
|
"/api": ""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
configureWebpack: {
|
|
|
|
}
|
|
} |