mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-09 06:55:07 +00:00
`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
11 lines
293 B
TypeScript
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}`
|
|
}
|