Files
GestionBanque/vite.config.ts
T
2026-05-19 20:17:04 +02:00

38 lines
1003 B
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import plugin from '@vitejs/plugin-react'
import fs from 'fs'
import path from 'path'
const certificateName = "reactapp1.client"
const baseFolder =
process.env.APPDATA !== undefined && process.env.APPDATA !== ''
? `${process.env.APPDATA}/ASP.NET/https`
: `${process.env.HOME}/.aspnet/https`
const certFilePath = path.join(baseFolder, `${certificateName}.pem`)
const keyFilePath = path.join(baseFolder, `${certificateName}.key`)
// création certificat uniquement si absent
if (!fs.existsSync(baseFolder)) {
fs.mkdirSync(baseFolder, { recursive: true })
}
export default defineConfig({
plugins: [plugin()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
https: {
key: fs.readFileSync(keyFilePath),
cert: fs.readFileSync(certFilePath),
},
port: 5176
}
})