From 417aec4b551ce56179e9f98831f0907487484760 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 19 Oct 2022 17:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E7=AB=AF?= =?UTF-8?q?=E5=8F=A38080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dev.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dev.js b/lib/dev.js index 784f7ea..5966743 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -14,7 +14,7 @@ const SERVER_OPTIONS = {} export default function createServer(root = '', conf = {}) { 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 DOMAIN = conf.devServer.domain || 'localhost' const WEB_SERVER = USE_HTTPS ? https : http @@ -175,7 +175,7 @@ export default function createServer(root = '', conf = {}) { .listen(PORT) .on('error', err => { console.log(`${PORT}端口被占用~~~`) - conf.devServer.port++ + conf.devServer.port = PORT + 1 createServer(root, conf) }) .on('listening', _ => {