import {defineConfig} from 'vite';
import {glob} from "glob";
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue'

const resourcePath = 'resources';
const jsPath = `${resourcePath}/js`;
const imagesPath = `${resourcePath}/images`;

export default defineConfig({
    plugins: [
        laravel({
            input: [
                `${resourcePath}/scss/public.scss`,
                `${resourcePath}/scss/admin.scss`,
                `${jsPath}/app.js`,
                ...glob.sync(`${jsPath}/pages/*/*.js`),
                ...glob.sync(`${jsPath}/components/*/*.js`),
                ...glob.sync(`${imagesPath}/*/*.avif`),
                ...glob.sync(`${imagesPath}/*/*.png`),
                ...glob.sync(`${imagesPath}/*/*.svg`),
            ],
            refresh: true,
        }),
        vue(),
    ],
    resolve: {
        alias: {
            '@': '/resources/ts',
            vue: 'vue/dist/vue.esm-bundler.js',
        },
    },
});