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(),
],
server: {
https: {
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()}"`,