// npm run dev # dev server
// npm run build # build for production
// npm run preview # preview production build

import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import tailwindcss from "@tailwindcss/vite";
import fs from "fs";

// Pfade zu deinen MAMP-Zertifikaten
const certPath = "/Applications/MAMP/Library/OpenSSL/certs/thats-me.test.crt";
const keyPath = "/Applications/MAMP/Library/OpenSSL/certs/thats-me.test.key";

export default defineConfig({
    plugins: [
        laravel({
            input: ["resources/css/app.css", "resources/js/app.js"],
            refresh: [`resources/views/**/*`],
        }),
        tailwindcss(),
    ],
    server: {
        https: {
            key: fs.readFileSync(keyPath),
            cert: fs.readFileSync(certPath),
        },
        cors: true, // Ergänze diese Zeile
        host: "192.168.1.8",
        port: 5173,
        hmr: {
            host: "192.168.1.8",
            protocol: "https",
        },
        origin: "https://192.168.1.8:5173",
    },
});
