let proxy = { '^/jianyu-page': { target: 'https://jybx-webtest.jydev.jianyu360.com', changeOrigin: true, logLevel: 'debug', pathRewrite: { '^/jianyu-page': '' } }, '^/api': { target: 'https://jybx-webtest.jydev.jianyu360.com', changeOrigin: true, logLevel: 'debug', pathRewrite: { '^/api': '' } } } function getProxy (prefix) { return { value: { target: 'https://jybx-webtest.jydev.jianyu360.com', changeOrigin: true, logLevel: 'debug', pathRewrite: { ['^/' + prefix]: '/' + prefix } }, key: ['^/' + prefix] } } ['dataExport', 'pccss', 'course', 'public-pc', 'js', 'css', 'jypay', 'subscribepay', 'front', 'common-module', 'page_big_pc' ].forEach(v => { const temp = getProxy(v) proxy[temp.key] = temp.value }) module.exports = proxy