forked from baron/baron-sso
- Centralized biome.json, tailwind.config.ts, and vite.config.ts into common/config. - Updated sub-apps to inherit from shared base configurations. - Deduplicated dependencies across apps using common workspace. - Fixed TypeScript resolution issues by restoring necessary build dependencies. - Removed obsolete package-lock.json files. - Applied minor import fixes via Biome. - Fixed react-router-dom v7 type errors.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { defineConfig, type UserConfig } from "vite";
|
|
|
|
export const commonViteConfig: UserConfig = {
|
|
plugins: [react()],
|
|
// Since we are using pnpm and common is our root, we might not need the strict aliases
|
|
// for react and lucide-react anymore, as pnpm will resolve them correctly from the root node_modules.
|
|
// If we do need them, we can add them back per-app or dynamically resolve from common's __dirname.
|
|
build: {
|
|
emptyOutDir: true,
|
|
},
|
|
};
|
|
|
|
export function hostFromUrl(value: string | undefined) {
|
|
if (!value) return undefined;
|
|
try {
|
|
return new URL(value).hostname;
|
|
} catch {
|
|
return value;
|
|
}
|
|
}
|
|
|
|
export function getAllowedHosts(
|
|
defaultHosts: string[],
|
|
envUrl?: string,
|
|
envAllowedHosts?: string
|
|
) {
|
|
return Array.from(
|
|
new Set(
|
|
[
|
|
...defaultHosts,
|
|
hostFromUrl(envUrl),
|
|
...(envAllowedHosts ?? "")
|
|
.split(",")
|
|
.map((host) => host.trim())
|
|
.filter(Boolean),
|
|
].filter((host): host is string => Boolean(host))
|
|
)
|
|
);
|
|
}
|
|
|
|
export default defineConfig(commonViteConfig);
|