增加默认端口8080
parent
d3245686be
commit
417aec4b55
|
@ -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', _ => {
|
||||||
|
|
Loading…
Reference in New Issue