增加默认端口8080

pull/1/head
yutent 2022-10-19 17:46:32 +08:00
parent d3245686be
commit 417aec4b55
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ const SERVER_OPTIONS = {}
export default function createServer(root = '', conf = {}) { export default function createServer(root = '', conf = {}) {
const IS_MPA = Object.keys(conf.pages).length > 1 const IS_MPA = Object.keys(conf.pages).length > 1
const PORT = conf.devServer.port const PORT = conf.devServer.port || 8080
const USE_HTTPS = conf.devServer.https const USE_HTTPS = conf.devServer.https
const DOMAIN = conf.devServer.domain || 'localhost' const DOMAIN = conf.devServer.domain || 'localhost'
const WEB_SERVER = USE_HTTPS ? https : http const WEB_SERVER = USE_HTTPS ? https : http
@ -175,7 +175,7 @@ export default function createServer(root = '', conf = {}) {
.listen(PORT) .listen(PORT)
.on('error', err => { .on('error', err => {
console.log(`${PORT}端口被占用~~~`) console.log(`${PORT}端口被占用~~~`)
conf.devServer.port++ conf.devServer.port = PORT + 1
createServer(root, conf) createServer(root, conf)
}) })
.on('listening', _ => { .on('listening', _ => {