Commit 4b3fa918 authored by 崔佳豪's avatar 崔佳豪

chore: 代理配置分离

parent 8484b5bd
......@@ -42,3 +42,6 @@ screenshot
# devServer-host
host/
webpack.host.js
.env
.env.local
\ No newline at end of file
import chalk from 'chalk';
import { readdirSync } from 'fs';
import { join } from 'path';
import proxy from './proxy';
const headPkgList = [];
const pkgList = ['base-components', 'extend-components']
.map((dir) => {
const list = readdirSync(join(__dirname, 'packages', dir)).map((item) => item + `!${dir}`);
const list = readdirSync(join(__dirname, '../packages', dir)).map((item) => item + `!${dir}`);
return list.filter((pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg));
})
.flat();
const alias = pkgList.reduce((pre, pkg) => {
const path = pkg.split('!');
pre[`@wisdom-components/pro-${path[0]}`] = join(__dirname, 'packages', path[1], path[0], 'src');
pre[`@wisdom-components/pro-${path[0]}`] = join(
__dirname,
'../packages',
path[1],
path[0],
'src',
);
return {
...pre,
};
......@@ -116,17 +123,12 @@ export default {
'EC_HistoryInfo',
'EC_RealTimeInfo',
'EC_ConfigurationView',
'EC_HistoryView',
],
},
],
},
proxy: {
'/api': {
target: 'http://192.168.10.150:8669',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
proxy,
define: {
DUMI_TYPE: 'dumi',
},
......
const proxyURL = process.env.PANDA_ENV_PROXY || 'http://192.168.10.150:8669';
export default {
'/api': {
target: 'http://192.168.10.150:8669',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
'/PandaMonitor': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaMonitor': '/PandaMonitor',
},
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment