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

export default defineConfig({
  plugins: [
    TanStackRouterVite({
      autoCodeSplitting: true,
      routeFileIgnorePattern: '__tests__',
    }),
    react(),
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  worker: {
    // ES module workers are required when the app uses code-splitting (Rollup
    // can't bundle IIFE workers alongside dynamic imports).
    format: "es",
  },
  server: {
    watch: {
      ignored: ['**/routeTree.gen.ts'],
    },
    proxy: {
      "/trpc": {
        target: "http://127.0.0.1:3847",
        changeOrigin: true,
      },
    },
  },
});
