Files
Termix/vite.config.ts
T

38 lines
956 B
TypeScript
Raw Normal View History

2025-09-12 14:42:00 -05:00
import path from "path";
2025-10-01 15:40:10 -05:00
import fs from "fs";
2025-09-12 14:42:00 -05:00
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
2025-08-07 02:20:27 -05:00
2025-10-01 15:40:10 -05:00
// SSL certificate paths
const sslCertPath = path.join(process.cwd(), "ssl/termix.crt");
const sslKeyPath = path.join(process.cwd(), "ssl/termix.key");
// Check if SSL certificates exist and HTTPS is requested
const hasSSL = fs.existsSync(sslCertPath) && fs.existsSync(sslKeyPath);
const useHTTPS = process.env.VITE_HTTPS === "true" && hasSSL;
2025-08-07 02:20:27 -05:00
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
2025-09-12 14:42:00 -05:00
base: "./",
2025-10-01 15:40:10 -05:00
build: {
sourcemap: false,
},
server: {
https: useHTTPS
? {
cert: fs.readFileSync(sslCertPath),
key: fs.readFileSync(sslKeyPath),
}
: false,
port: 5173,
host: "localhost",
},
2025-09-12 14:42:00 -05:00
});