fix(build): extract FAVICON_SERVICE_URL to prevent server-side createContext error

The share/[id] layout is a server component that imported FAVICON_SERVICE_URL
from icons.tsx, pulling in the entire React icon registry and triggering
createContext on the server. Moved the constant to its own favicon.ts module.
This commit is contained in:
Usman Baig
2026-03-23 13:29:53 +01:00
parent 75bf8acd1e
commit 55a08301f4
6 changed files with 14 additions and 9 deletions

8
lib/utils/favicon.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* Google's public favicon service base URL.
* Append `?domain=<host>&sz=<px>` to get a favicon.
*
* Kept in a separate module so server components can import it
* without pulling in the React-dependent icon registry.
*/
export const FAVICON_SERVICE_URL = 'https://www.google.com/s2/favicons'

View File

@@ -43,11 +43,8 @@ function BingIcon({ size = 16, color = '#258FFA' }: { size?: number; color?: str
return <svg width={size} height={size} viewBox="0 0 24 24" fill={color}><path d="M5.71 0v18.39l4.44 2.46 8.14-4.69v-4.71l-8.14-2.84V4.09L5.71 0zm4.44 11.19l4.39 1.53v2.78l-4.39 2.53v-6.84z"/></svg>
}
/**
* Google's public favicon service base URL.
* Append `?domain=<host>&sz=<px>` to get a favicon.
*/
export const FAVICON_SERVICE_URL = 'https://www.google.com/s2/favicons'
import { FAVICON_SERVICE_URL } from './favicon'
export { FAVICON_SERVICE_URL }
// ─── Browser, OS, Device icons (unchanged) ───────────────────────────────────