Skip to content

Commit bddd64d

Browse files
authored
fix: optimize the judgment on whether HTTPS has been set in options (#7202)
1 parent ef08a08 commit bddd64d

File tree

1 file changed

+5
-1
lines changed
  • packages/@vue/cli-service/lib/commands

1 file changed

+5
-1
lines changed

packages/@vue/cli-service/lib/commands/serve.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ module.exports = (api, options) => {
101101
}
102102

103103
// resolve server options
104-
const useHttps = args.https || projectDevServerOptions.https || defaults.https
104+
const modesUseHttps = ['https', 'http2']
105+
const serversUseHttps = ['https', 'spdy']
106+
const optionsUseHttps = modesUseHttps.some(modeName => !!projectDevServerOptions[modeName]) ||
107+
(typeof projectDevServerOptions.server === 'string' && serversUseHttps.includes(projectDevServerOptions.server))
108+
const useHttps = args.https || optionsUseHttps || defaults.https
105109
const protocol = useHttps ? 'https' : 'http'
106110
const host = args.host || process.env.HOST || projectDevServerOptions.host || defaults.host
107111
portfinder.basePort = args.port || process.env.PORT || projectDevServerOptions.port || defaults.port

0 commit comments

Comments
 (0)