cloudflare / vinext

fix: add 'use client' to next/dynamic shim for App Router RSC compatibility (#7)
When a server component imports next/dynamic, the RSC serializer must treat it as a client boundary. Without 'use client', the dynamic() function executes inline in the RSC environment — for ssr:false, this serializes null into the RSC payload and the client never loads the component. Adding 'use client' matches Next.js's App Router behavior where next/dynamic is a client module. The RSC serializer emits a client reference, and the client executes the full dynamic logic including the ssr:false mount-on-client behavior. Updated test fixtures that called dynamic() from server modules to include 'use client' — this is required since dynamic() is now a client export and can only be called from client modules. Added E2E test for ssr:false from a server component page.
Sunil Pai Sunil Pai committed on Feb 24, 2026, 05:13 PM
Showing 6 changed files +53 additions -0 deletions
Browse files at this commit →