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

export default defineConfig({
  base: process.env.VITE_APP_BASENAME || '/',
  define: {
    'process.env.VITE_APP_VERSION': JSON.stringify(process.env.VITE_APP_VERSION),
  },
  plugins: [
    tailwindcss(),
    react({
      jsxImportSource: '@emotion/react',
      babel: {
        plugins: ['@emotion/babel-plugin'],
      },
    }),
    svgr({
      include: '**/*.svg?react',
    }),
  ],
  assetsInclude: ['**/*.md'],
  server: {
    open: true,
    port: 3000,
    watch: { ignored: ['**/tests/**', '**/auth_states/**', '**/ios/**', '**/android/**'] },
  },
  build: {
    outDir: 'build',
  },
  resolve: {
    alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
  },
});
