import tailwindcss from "@tailwindcss/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
  base: "/cotizador-wmc/",
  plugins: [
    // File-based routing for the client-only SPA build.
    // Keep this plugin before React, as recommended by TanStack Router.
    tanstackRouter({
      target: "react",
      autoCodeSplitting: true,
    }),
    tailwindcss(),
    react(),
  ],
  resolve: {
    dedupe: ["react", "react-dom", "@tanstack/react-router"],
    // Vite 8 resolves tsconfig path aliases natively.
    tsconfigPaths: true,
  },
  build: {
    // Explicitly keep the same convention used by the other GLM frontends.
    outDir: "dist",
    emptyOutDir: true,
  },
});
