import { defineConfig as defineViteConfig, mergeConfig } from 'vite';
import { defineConfig as defineVitestConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tailwindcss from "@tailwindcss/vite";


// https://vitejs.dev/config/
const viteonfig = defineViteConfig({
    plugins: [
        react(),
        tailwindcss()
    ],
    // Add any CRACO-specific configurations here, adapted for Vite
    resolve: {
        alias: {
            '@': '/src',
            "*": "/src/@custom_types"
        }
    },
    server: {
        port: 3059,
        watch: {
            usePolling: true
        }
    }
})

const vitestConfig = defineVitestConfig({
    test: {
        globals: true, // Enable global access to Vitest utilities
        environment: 'jsdom',
        setupFiles: "./src/tests/setup.ts",
        coverage: {
            reportsDirectory: './coverage', // Specify the output directory for coverage reports
            reporter: ['text', 'html'], // Define the formats for the coverage report
        }
    }
});

export default mergeConfig(viteonfig, vitestConfig)
