From f914ada22b973dce3fd1ffaae02071cf591b0e15 Mon Sep 17 00:00:00 2001 From: thislight Date: Sun, 27 Oct 2024 00:28:01 +0800 Subject: [PATCH] vite: fix https is enabled if cert is not present --- vite.config.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index b049e93..db04793 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -88,13 +88,15 @@ export default defineConfig(({ mode }) => { version(), ], server: { - https: { - // This config controls https for the *dev server*. - // See docs/dev-https.md for setting up https - key: serverHttpCertKey, - cert: serverHttpCertCrt, - passphrase: serverHttpCertPassword, - }, + https: serverHttpCertBase + ? { + // This config controls https for the *dev server*. + // See docs/dev-https.md for setting up https + key: serverHttpCertKey, + cert: serverHttpCertCrt, + passphrase: serverHttpCertPassword, + } + : undefined, }, define: { "import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,