import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'path'; import postcssPresetMantine from 'postcss-preset-mantine'; import postcssSimpleVars from 'postcss-simple-vars'; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ plugins: [ react({ include: ['**/*.jsx', '**/*.js'], }), ], root: 'src', publicDir: '../public', build: { outDir: '../dist', emptyOutDir: true, assetsDir: 'assets', sourcemap: mode === 'development', rollupOptions: { input: { main: path.resolve(__dirname, 'src/index.html'), }, }, }, server: { port: 3000, open: true, }, define: { 'window.API_BASE_URL': JSON.stringify( mode === 'production' ? '/api/v1' : 'http://localhost:8080/api/v1' ), }, css: { preprocessorOptions: { scss: { api: 'modern', }, }, postcss: { plugins: [ postcssPresetMantine(), postcssSimpleVars({ variables: { 'mantine-breakpoint-xs': '36em', 'mantine-breakpoint-sm': '48em', 'mantine-breakpoint-md': '62em', 'mantine-breakpoint-lg': '75em', 'mantine-breakpoint-xl': '88em', }, }), ], }, }, resolve: { alias: { '@': path.resolve(__dirname, './src'), }, extensions: ['.js', '.jsx', '.json'], }, }));