From 19c06951463e6938d0edc8be5284aa1a4c39c829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E4=BF=8A=E8=B6=85?= Date: Fri, 4 Mar 2022 09:57:46 +0800 Subject: [PATCH 1/3] feat(cli-server): Support webpack5 devServer.server configuration options 'https' is deprecated in favor of the devServer.server option. --- packages/@vue/cli-service/lib/commands/serve.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index 6ed4ee8b2c..ddad53d960 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -98,8 +98,12 @@ module.exports = (api, options) => { } } + // Compatible with server in webpack5 + const projectDevServerType = typeof projectDevServerOptions.server === 'string' ? projectDevServerOptions.server : typeof (projectDevServerOptions.server || {}).type === 'string' ? projectDevServerOptions.server.type : 'http' + const httpsTypes = ['https', 'spdy'] + // resolve server options - const useHttps = args.https || projectDevServerOptions.https || defaults.https + const useHttps = args.https || args.http2 || projectDevServerOptions.https || defaults.https || httpsTypes.includes(args['server-type']) || httpsTypes.includes(projectDevServerType) 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 From 665ee343300ff341863dc594c982afcf3fbb446a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99?= Date: Wed, 13 Apr 2022 16:20:50 +0800 Subject: [PATCH 2/3] add serverSetting --- packages/@vue/cli-service/lib/commands/serve.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index ddad53d960..bf8a3c40b9 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -9,7 +9,7 @@ const { const defaults = { host: '0.0.0.0', port: 8080, - https: false + server: 'http' } /** @type {import('@vue/cli-service').ServicePlugin} */ @@ -24,7 +24,7 @@ module.exports = (api, options) => { '--mode': `specify env mode (default: development)`, '--host': `specify host (default: ${defaults.host})`, '--port': `specify port (default: ${defaults.port})`, - '--https': `use https (default: ${defaults.https})`, + '--https': `use https (default: ${defaults.server ==='https' || defaults.server ==='spdy'})`, '--public': `specify the public network URL for the HMR client`, '--skip-plugins': `comma-separated list of plugin names to skip for this run` } @@ -101,9 +101,10 @@ module.exports = (api, options) => { // Compatible with server in webpack5 const projectDevServerType = typeof projectDevServerOptions.server === 'string' ? projectDevServerOptions.server : typeof (projectDevServerOptions.server || {}).type === 'string' ? projectDevServerOptions.server.type : 'http' const httpsTypes = ['https', 'spdy'] + const serverSetting = args['server-type'] || (process.env.HTTPS === 'true' ? 'https' : 'http') || projectDevServerOptions.server || defaults.server // resolve server options - const useHttps = args.https || args.http2 || projectDevServerOptions.https || defaults.https || httpsTypes.includes(args['server-type']) || httpsTypes.includes(projectDevServerType) + const useHttps = args.https || args.http2 || process.env.HTTPS === 'true' || httpsTypes.includes(defaults.https) || httpsTypes.includes(args['server-type']) || httpsTypes.includes(projectDevServerType) 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 @@ -197,7 +198,7 @@ module.exports = (api, options) => { }, projectDevServerOptions, { host, port, - https: useHttps, + server: serverSetting, proxy: proxySettings, static: { From 35654e7784673de37d1214cf050ff810afd0da91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99?= Date: Wed, 13 Apr 2022 16:28:03 +0800 Subject: [PATCH 3/3] fix: add devServer serverSetting & format code --- packages/@vue/cli-service/lib/commands/serve.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index bf8a3c40b9..d5796e3bc6 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -24,7 +24,7 @@ module.exports = (api, options) => { '--mode': `specify env mode (default: development)`, '--host': `specify host (default: ${defaults.host})`, '--port': `specify port (default: ${defaults.port})`, - '--https': `use https (default: ${defaults.server ==='https' || defaults.server ==='spdy'})`, + '--https': `use https (default: ${defaults.server === 'https' || defaults.server === 'spdy'})`, '--public': `specify the public network URL for the HMR client`, '--skip-plugins': `comma-separated list of plugin names to skip for this run` } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy