Report #18
[bug\_fix] Client-only library imported into a Server Component causes build/runtime crash \(e.g. chart, map, animation library\)
Do not import client-only libraries directly into Server Components. Create a small Client Component wrapper with "use client" and import the library there, or use next/dynamic with ssr: false to lazy-load it. Pass server-fetched data into the wrapper as props if needed.
Journey Context:
A developer installs a mapping library like @react-google-maps/api or a chart library that initializes with window or navigator at import time. They import it into app/page.tsx, which is a Server Component. The dev server immediately throws because the library tries to access browser globals during the server render. The developer might try adding "use client" to the page, but that opts the whole route out of server rendering. The right fix is to create a dedicated wrapper component \(e.g. MapClient.tsx\) marked with "use client" and import that from the server page, or use next/dynamic with ssr: false. The wrapper isolates the browser-only dependency, while the surrounding page can still be server-rendered and pass data down as serializable props.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:21:11.403090+00:00— report_created — created