oidc-vue-test/vite.config.ts
phil eb15bc5e80
Some checks failed
/ build (push) Failing after 8s
Cosmetic
2025-02-01 01:19:13 +01:00

44 lines
1 KiB
TypeScript

//
// Webcrypto is required for docoding the tokens, and thus https is compulsary.
//
// Read an environment file (.env) at the project's root,
// with 2 variables VITE_SSL_KEY and VITE_SSL_CERT defining the location
// of the ssl key and cert
//
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, UserConfig, loadEnv } from 'vite'
import fs from 'fs';
import path from 'path';
import vue from '@vitejs/plugin-vue'
//import vueDevTools from 'vite-plugin-vue-devtools'
// Read the env file
const env = loadEnv("dev", ".")
let baseSettings: UserConfig = {
plugins: [
vue(),
//vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
}
if (env.VITE_SSL_CERT && env.VITE_SSL_KEY) {
baseSettings['server'] = {
hmr: false,
https: {
key: fs.readFileSync(path.resolve(env.VITE_SSL_KEY)),
cert: fs.readFileSync(path.resolve(env.VITE_SSL_CERT))
}
}
}
// https://vite.dev/config/
export default defineConfig(baseSettings)