vite: fix https is enabled if cert is not present

This commit is contained in:
thislight 2024-10-27 00:28:01 +08:00
parent 130a989185
commit f914ada22b
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E

View file

@ -88,13 +88,15 @@ export default defineConfig(({ mode }) => {
version(), version(),
], ],
server: { server: {
https: { https: serverHttpCertBase
? {
// This config controls https for the *dev server*. // This config controls https for the *dev server*.
// See docs/dev-https.md for setting up https // See docs/dev-https.md for setting up https
key: serverHttpCertKey, key: serverHttpCertKey,
cert: serverHttpCertCrt, cert: serverHttpCertCrt,
passphrase: serverHttpCertPassword, passphrase: serverHttpCertPassword,
}, }
: undefined,
}, },
define: { define: {
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`, "import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,