import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
  plugins: [
    react(), // React uchun
    tailwindcss(), // Tailwind CSS integratsiyasi
    tsconfigPaths(), // @ alias yo‘llarini avtomatik o‘qish
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    host: true,
    port: 5173,
  },
  build: {
    outDir: "dist", // Vercel build chiqishini shu papkadan oladi
    sourcemap: false, // Agar kerak bo‘lmasa o‘chirib qo‘ying
  },
  base: "/", // <— Muhim: nisbiy yo‘l, Vercel’da assetlar to‘g‘ri yuklanadi
});
