Skip to content

Commit

Permalink
fix: optimize the judgment on whether HTTPS has been set in options (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
backrunner committed Jul 4, 2022
1 parent ef08a08 commit bddd64d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@vue/cli-service/lib/commands/serve.js
Expand Up @@ -101,7 +101,11 @@ module.exports = (api, options) => {
}

// resolve server options
const useHttps = args.https || projectDevServerOptions.https || defaults.https
const modesUseHttps = ['https', 'http2']
const serversUseHttps = ['https', 'spdy']
const optionsUseHttps = modesUseHttps.some(modeName => !!projectDevServerOptions[modeName]) ||
(typeof projectDevServerOptions.server === 'string' && serversUseHttps.includes(projectDevServerOptions.server))
const useHttps = args.https || optionsUseHttps || defaults.https
const protocol = useHttps ? 'https' : 'http'
const host = args.host || process.env.HOST || projectDevServerOptions.host || defaults.host
portfinder.basePort = args.port || process.env.PORT || projectDevServerOptions.port || defaults.port
Expand Down

0 comments on commit bddd64d

Please sign in to comment.