2025-11-06 00:09:35 -08:00
|
|
|
import path from "node:path";
|
2025-12-02 15:32:00 +05:30
|
|
|
import * as dotenv from "@dotenvx/dotenvx";
|
2025-11-06 00:09:35 -08:00
|
|
|
import { reactRouter } from "@react-router/dev/vite";
|
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
|
import { joinUrlPath } from "@plane/utils";
|
|
|
|
|
|
2025-11-13 17:57:47 +05:30
|
|
|
dotenv.config({ path: path.resolve(__dirname, ".env") });
|
|
|
|
|
|
2025-11-12 19:03:47 +05:30
|
|
|
// Expose only vars starting with VITE_
|
|
|
|
|
const viteEnv = Object.keys(process.env)
|
|
|
|
|
.filter((k) => k.startsWith("VITE_"))
|
|
|
|
|
.reduce<Record<string, string>>((a, k) => {
|
|
|
|
|
a[k] = process.env[k] ?? "";
|
|
|
|
|
return a;
|
2025-11-11 14:08:42 +05:30
|
|
|
}, {});
|
2025-11-06 00:09:35 -08:00
|
|
|
|
2025-11-12 19:03:47 +05:30
|
|
|
const basePath = joinUrlPath(process.env.VITE_ADMIN_BASE_PATH ?? "", "/") ?? "/";
|
2025-11-06 00:09:35 -08:00
|
|
|
|
2025-11-11 14:08:42 +05:30
|
|
|
export default defineConfig(() => ({
|
|
|
|
|
base: basePath,
|
|
|
|
|
define: {
|
2025-11-12 19:03:47 +05:30
|
|
|
"process.env": JSON.stringify(viteEnv),
|
2025-11-11 14:08:42 +05:30
|
|
|
},
|
|
|
|
|
build: {
|
|
|
|
|
assetsInlineLimit: 0,
|
|
|
|
|
},
|
|
|
|
|
plugins: [reactRouter(), tsconfigPaths({ projects: [path.resolve(__dirname, "tsconfig.json")] })],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
// Next.js compatibility shims used within admin
|
|
|
|
|
"next/link": path.resolve(__dirname, "app/compat/next/link.tsx"),
|
|
|
|
|
"next/navigation": path.resolve(__dirname, "app/compat/next/navigation.ts"),
|
2025-11-06 00:09:35 -08:00
|
|
|
},
|
2025-11-11 14:08:42 +05:30
|
|
|
dedupe: ["react", "react-dom"],
|
|
|
|
|
},
|
2025-11-13 17:57:47 +05:30
|
|
|
server: {
|
|
|
|
|
host: "127.0.0.1",
|
|
|
|
|
},
|
2025-11-11 14:08:42 +05:30
|
|
|
// No SSR-specific overrides needed; alias resolves to ESM build
|
|
|
|
|
}));
|