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

export default defineConfig({
	plugins: [
		TanStackRouterVite({
			target: "react",
			autoCodeSplitting: true,
			routesDirectory: "./src/client/routes",
			generatedRouteTree: "./src/client/routeTree.gen.ts",
		}),
		react(),
		tailwindcss(),
	],
	server: {
		proxy: {
			"/api": "http://localhost:3000",
			"/uploads": "http://localhost:3000",
			"/login": { target: "http://localhost:3000", changeOrigin: false },
			"/callback": { target: "http://localhost:3000", changeOrigin: false },
			"/logout": { target: "http://localhost:3000", changeOrigin: false },
			"/.well-known": "http://localhost:3000",
			"/oauth": "http://localhost:3000",
		},
	},
	build: {
		outDir: "dist/client",
	},
});
