lighting-plugin-proxy
Advanced tools
+11
-5
@@ -19,4 +19,4 @@ let version = require('./package.json').version; | ||
| build:function (light,cb) { | ||
| // get proxy config | ||
| if(light.config.pluginConfig && light.config.pluginConfig.proxy){ | ||
| if (light.config.pluginConfig && light.config.pluginConfig.proxy) { | ||
| let config = light.config.pluginConfig.proxy | ||
@@ -27,6 +27,12 @@ | ||
| //对每一个proxyMap进行配置 | ||
| Object.keys(config).forEach(key=>{ | ||
| let r = proxyMiddleware(key, {target: config[key], changeOrigin: true}); | ||
| Object.keys(config).forEach(key => { | ||
| //136183 支持自定义proxy配置 | ||
| let proxyOpts; | ||
| if (typeof (config[key]) === "string") { | ||
| proxyOpts = { target: config[key], changeOrigin: true } | ||
| } else { | ||
| proxyOpts = config[key]; | ||
| } | ||
| let r = proxyMiddleware(key, proxyOpts); | ||
| global.middleware.push(r); | ||
@@ -33,0 +39,0 @@ }) |
+1
-1
| { | ||
| "name": "lighting-plugin-proxy", | ||
| "main": "index.js", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "dependencies": { | ||
@@ -6,0 +6,0 @@ "http-proxy-middleware": "^0.19.1" |
1620
18.08%46
15%