UNPKG

377 BJavaScriptView Raw
1module.exports = (port, env = process.env.WEBPACK_BUILD_ENV) => {
2 const {
3 SERVER_PORT,
4 } = process.env
5
6 if (typeof port === 'object') {
7 if (typeof port[env] !== 'undefined')
8 return port[env]
9 return SERVER_PORT
10 }
11
12 if (typeof port !== 'undefined' && typeof port !== 'boolean')
13 return port
14
15 return SERVER_PORT
16}