20 lines
870 B
TypeScript
20 lines
870 B
TypeScript
/**
|
||
* Emits <link rel="preconnect"> + <link rel="dns-prefetch"> for the media CDN
|
||
* domain (R2_PUBLIC_URL), so the browser opens the TLS/DNS connection to the
|
||
* media host early — before it hits the first <img>. Saves ~150–300ms on the
|
||
* first image load.
|
||
*
|
||
* Reads the domain from R2_PUBLIC_URL (the same env var buildR2Storage uses),
|
||
* so there's ONE source of truth — no per-project hardcoded domain. Renders
|
||
* nothing when R2_PUBLIC_URL isn't set (local disk / no CDN → nothing to
|
||
* preconnect).
|
||
*
|
||
* Server Component — drop it in the <head> of your locale layout:
|
||
*
|
||
* import { MediaPreconnect } from '@intecion/ipal-kit/rsc'
|
||
* // in <head> (or top of <body> — Next hoists link tags):
|
||
* <MediaPreconnect />
|
||
*/
|
||
export declare function MediaPreconnect(): import("react/jsx-runtime").JSX.Element | null;
|
||
export default MediaPreconnect;
|