diff --git a/vite.config.ts b/vite.config.ts index 404d07e..f5688dd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,20 +1,22 @@ import path from "path"; -import { ServerOptions as HttpsServerOptions } from "https"; +import { ServerOptions } from "https"; import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; import ViteYaml from "@modyfi/vite-plugin-yaml"; import { visualizer } from "rollup-plugin-visualizer"; +type HttpsOptions = Pick; + // https://vitejs.dev/config/ export default defineConfig(async ({ mode }) => { // Load .env files. Vite will do it itself, but only later. See https://github.com/vitejs/vite/issues/1930 Object.assign(process.env, loadEnv(mode, process.cwd(), "")); - // Read HTTPS cert and key, if their paths are specified in env. - async function getHttpsOptions(): Promise { + /** Read HTTPS cert and key, if their paths are specified in env. */ + async function getHttpsOptions(): Promise { if (process.env.DEV_HTTPS_KEY && process.env.DEV_HTTPS_CERT) { const fs = await import("fs"); - return { + return { key: fs.readFileSync(process.env.DEV_HTTPS_KEY), cert: fs.readFileSync(process.env.DEV_HTTPS_CERT), };