import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';

export default defineConfig({
    plugins: [
        react(),
        svgr({
            svgrOptions: {
                exportType: 'default',
                ref: true,
                svgo: false,
                titleProp: true,
            },
            include: '**/*.svg',
        }),
    ],
    css: {
        modules: {
            /**
             * Will generate classnames like `.Button__3xqOy`
             * Placing hash after `__` so it can be stripped by a11y monitor
             * @see https://github.com/preply/apollo/blob/master/yarn-workspace/packages/shared/src/a11y/a11yMonitor/tests/utils.ts
             */
            generateScopedName: '[local]__[hash:base64:5]',
        },
    },
});
