AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Module Fragments Panic When Passing A Plain Function Export From A 'Use Client' Module As Prop

Next.js 16.5.0-canary.3 with `turbopackModuleFragments` enabled panics during build with `ModuleId not found for ident ... [app-client] (ecmascript) <internal part 0>` when a server component references a plain function exported from a 'use client' module that imports another module.

highConfidence 85%Next.jsAffected V16.5.0-Canary.3

Origin Analysis

Turbopack's module fragmentation assigns an internal part identifier (<internal part 0>) to the exported function, but fails to register a module ID for that part in the chunk item content, causing `ModuleId not found` during `EcmascriptModuleContent::new`. The bug is triggered by the combination of a plain function export (no JSX) and an import inside the 'use client' module.
1. Clone https://github.com/stefanprobst/turbopack-module-fragments-repro 2. pnpm install 3. pnpm run build 4. Observe panic in Turbopack with error 'ModuleId not found for ident ... [app-client] (ecmascript) <internal part 0>'

Fixing Code Block

Edge Case Audit

Disabling module fragments may increase client bundle size and remove the intended chunk splitting optimizations in this canary version. This is a temporary workaround, not a permanent fix. Roll back by removing the flag once a patched Next.js version is released. Also verify the config option is supported in your version; in older versions the flag may be ignored or cause a warning.

Ecosystem Topology