import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import path from "path";

export default defineConfig({
    plugins: [
        laravel({
            input: ["themes/default/sass/app.scss", "themes/default/js/app.js"],
            buildDirectory: "build",
        }),
        {
            name: "blade",
            handleHotUpdate({ file, server }) {
                if (file.endsWith(".blade.php")) {
                    server.ws.send({
                        type: "full-reload",
                        path: "*",
                    });
                }
            },
        },
    ],
    resolve: {
        alias: {
            "@": "/themes/default/js",
            "~bootstrap": path.resolve("node_modules/bootstrap"),
        },
    },
});
