From 39abca96980d596753d1e0fc68ba1f3c2e32d320 Mon Sep 17 00:00:00 2001 From: Jonah Date: Wed, 10 Jan 2024 08:33:43 +0100 Subject: [PATCH] feat: respect user defined settings (#16) --- src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c9cad38..5f80cae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,8 +10,12 @@ function viteBasicSslPlugin(): Plugin { async configResolved(config) { const certificate = await getCertificate((config.cacheDir ?? defaultCacheDir) + '/basic-ssl') const https = () => ({ cert: certificate, key: certificate }) - config.server.https = Object.assign({}, config.server.https, https()) - config.preview.https = Object.assign({}, config.preview.https, https()) + if (config.server.https === undefined || !!config.server.https) { + config.server.https = Object.assign({}, config.server.https, https()) + } + if (config.preview.https === undefined || !!config.preview.https) { + config.preview.https = Object.assign({}, config.preview.https, https()) + } } } }