diff --git a/.gitignore b/.gitignore index f7900ec6fd89c6c82226b2290b140c4acbf27a0f..a641165705b23a6b103809206edf671022a6b858 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,7 @@ screenshot # devServer-host host/ -webpack.host.js \ No newline at end of file +webpack.host.js + +.env +.env.local \ No newline at end of file diff --git a/.umirc.js b/config/config.js similarity index 88% rename from .umirc.js rename to config/config.js index a29fb95a8fad906357f0bebe50df9a6fb8fb7f81..bda137c3e8a0aa51b65d74349d36b7e6932da645 100644 --- a/.umirc.js +++ b/config/config.js @@ -1,19 +1,26 @@ 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', }, diff --git a/config/proxy.js b/config/proxy.js new file mode 100644 index 0000000000000000000000000000000000000000..04a2c78e0832aeae3977d1768b878e8c7c0893a9 --- /dev/null +++ b/config/proxy.js @@ -0,0 +1,19 @@ +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', + }, + }, +};