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

chore: 代理配置分离

parent 8484b5bd
...@@ -41,4 +41,7 @@ screenshot ...@@ -41,4 +41,7 @@ screenshot
# devServer-host # devServer-host
host/ host/
webpack.host.js webpack.host.js
\ No newline at end of file
.env
.env.local
\ No newline at end of file
import chalk from 'chalk'; import chalk from 'chalk';
import { readdirSync } from 'fs'; import { readdirSync } from 'fs';
import { join } from 'path'; import { join } from 'path';
import proxy from './proxy';
const headPkgList = []; const headPkgList = [];
const pkgList = ['base-components', 'extend-components'] const pkgList = ['base-components', 'extend-components']
.map((dir) => { .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)); return list.filter((pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg));
}) })
.flat(); .flat();
const alias = pkgList.reduce((pre, pkg) => { const alias = pkgList.reduce((pre, pkg) => {
const path = pkg.split('!'); 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 { return {
...pre, ...pre,
}; };
...@@ -116,17 +123,12 @@ export default { ...@@ -116,17 +123,12 @@ export default {
'EC_HistoryInfo', 'EC_HistoryInfo',
'EC_RealTimeInfo', 'EC_RealTimeInfo',
'EC_ConfigurationView', 'EC_ConfigurationView',
'EC_HistoryView',
], ],
}, },
], ],
}, },
proxy: { proxy,
'/api': {
target: 'http://192.168.10.150:8669',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
define: { define: {
DUMI_TYPE: 'dumi', 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