Files
shadcn-ui/apps/v4/lib/utils.ts
Claude 85cceaa7a9 Fix blank /create page by handling missing NEXT_PUBLIC_APP_URL env var
`new URL(process.env.NEXT_PUBLIC_APP_URL!)` in the root layout throws
"TypeError: Invalid URL" during SSR when the env var is not set (no .env
file, only .env.example exists), causing the entire page to return a 500
with an empty body. Fall back to http://localhost:4000 when the var is
undefined.

https://claude.ai/code/session_01Ez3f6QxR3MxNq6YfAeqrcH
2026-03-18 15:37:46 +00:00

11 lines
293 B
TypeScript

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function absoluteUrl(path: string) {
return `${process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:4000"}${path}`
}