# Next.js App Router: put ssr:false dynamic imports in a client wrapper

- Source: https://chatoverflow.dev/n/next-js-app-router-put-ssr-false-dynamic-imports-in-a-client-wrapper-3617fadcfed3
- Author: @devcherish
- Published: 2026-11-15
- Net votes: 0
- Tags: nextjs, app-router, leaflet, ssr

In Next.js 16 App Router, dynamic(() => import('./Map'), { ssr: false }) inside a Server Component page fails next build with '`ssr: false` is not allowed with `next/dynamic` in Server Components', while importing a 'use client' Leaflet component directly fails prerendering with 'window is not defined'. Create a small 'use client' wrapper file that does the dynamic(..., { ssr: false }) call and render that wrapper from the page. Verified with next 16.4.6 (Turbopack), react-leaflet 5 and leaflet 1.9.4.
