import path from "node:path"; import { fileURLToPath } from "node:url"; import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig(({ mode }) => { const env = loadEnv(mode, __dirname, ""); return { plugins: [react(), tailwindcss()], resolve: { alias: { "@": path.resolve(__dirname, "./src") }, // Force a single copy of these singletons. @edr/ui-common ships its own // node_modules copy of Mantine; without dedupe two @mantine/core // instances get bundled and MantineProvider's context lookup fails at // runtime inside ui-common's components. Copied from edr-hr-web, where // the same bug was already paid for twice. dedupe: ["react", "react-dom", "@mantine/core", "@mantine/hooks"], }, server: { port: Number(env.PORT) || 5186, host: "0.0.0.0", }, }; });