合并两个工位的 ERP 页面、存储过程及测试工具,分离 8010 与 9528 工位配置
This commit is contained in:
@@ -15,6 +15,34 @@ function resolve(dir) {
|
||||
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
const local9528 = HOST === '127.0.0.1' && PORT === 9528 && process.env.JY_AI_EMPLOYEE === '1'
|
||||
const employeePaths = [
|
||||
'/submit/AIEmployeeLogin.ashx',
|
||||
'/submit/AICurrentEmployee.ashx',
|
||||
'/submit/AIPurchaseInvoiceFile.ashx',
|
||||
'/submit/MESCommonBase.ashx',
|
||||
'/submit/AIEmployeeLogout.ashx'
|
||||
]
|
||||
const proxy = Object.assign({}, config.dev.proxyTable)
|
||||
if (process.env.JY_AI_EMPLOYEE === '1') {
|
||||
employeePaths.forEach(function (route) {
|
||||
proxy[route] = {
|
||||
target: 'http://127.0.0.1:19529',
|
||||
changeOrigin: true,
|
||||
logLevel: 'silent',
|
||||
bypass: function (req) {
|
||||
if (req.url.split('?')[0] !== route) return req.url
|
||||
},
|
||||
onProxyReq: function (upstream, req) {
|
||||
const ticket = (req.headers.cookie || '').split(';').map(value => value.trim())
|
||||
.find(value => value.indexOf('JY_AI_EMPLOYEE=') === 0)
|
||||
if (ticket) upstream.setHeader('cookie', ticket)
|
||||
else upstream.removeHeader('cookie')
|
||||
upstream.removeHeader('authorization')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
mode: 'development',
|
||||
@@ -40,7 +68,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
? { warnings: false, errors: true }
|
||||
: false,
|
||||
publicPath: config.dev.assetsPublicPath,
|
||||
proxy: config.dev.proxyTable,
|
||||
proxy: proxy,
|
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: {
|
||||
poll: config.dev.poll
|
||||
@@ -65,11 +93,20 @@ const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
]
|
||||
})
|
||||
|
||||
if (local9528) {
|
||||
const serviceConfig = resolve('static/config.js')
|
||||
devWebpackConfig.module.rules.unshift({
|
||||
enforce: 'pre',
|
||||
test: file => file === serviceConfig,
|
||||
use: [resolve('build/9528-service-loader.js')]
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = new Promise((resolve, reject) => {
|
||||
portfinder.basePort = process.env.PORT || config.dev.port
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
if (err || (local9528 && port !== 9528)) {
|
||||
reject(err || new Error('本机 9528 端口已被占用'))
|
||||
} else {
|
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port
|
||||
|
||||
Reference in New Issue
Block a user