Files
zeekayandGitHub b27d2eef7d fix(frontend): render-safe SPA — tsgo 0, kill next-themes blank-page crash, o11y-site from source (#14)
tsgo 707->0; alias next-themes/next/* to browser stubs (kills blank-page crash); resolve [[.BaseHref]]/[[.Settings]] at build time; Dockerfile.site builds from source; [email protected].4 pin. Render-proven (Playwright, all routes, 0 ReferenceError).
2026-07-03 16:21:48 -07:00

23 lines
859 B
TypeScript

// Browser stub for `next/image`, eagerly imported by the @hanzo/ui barrel
// (`import Image from 'next/image'`). o11y is not a Next app; this degrades to a
// plain <img>. Must resolve to a real module (aliased in vite.config.ts), never be
// externalized — a bare `next/image` specifier is unresolvable in the browser and
// crashes the SPA at load.
import { createElement, forwardRef } from 'react';
import type { ImgHTMLAttributes, Ref } from 'react';
type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src'> & {
src?: string | { src?: string };
alt?: string;
};
const Image = forwardRef(function Image(
{ src, alt = '', ...rest }: ImageProps,
ref: Ref<HTMLImageElement>,
) {
const resolvedSrc = typeof src === 'string' ? src : src?.src;
return createElement('img', { ref, src: resolvedSrc, alt, ...rest });
});
export default Image;