import liveReload from 'vite-plugin-live-reload';
import VitePluginSvgSpritemap from '@spiriit/vite-plugin-svg-spritemap';

export default ({command}) => {
    return {
        base: command === 'serve' ? '/themes/vite-tailwind/' : '/themes/vite-tailwind/assets/public/',
        publicDir: 'resources/public',
        build: {
            manifest: 'manifest.json',
            outDir: 'assets/public',
            assetsDir: '',
            rollupOptions: {
                input: 'resources/js/app.js',
            },
        },
        server: {
            strictPort: true,
            port: 3000,
        },
        resolve: {
            extensions: ['.js', '.mjs'],
        },
        plugins: [liveReload('./**/*.htm'), VitePluginSvgSpritemap('./resources/icons/*.svg')],
    };
};
