docs/solutions/developer-experience/2026-04-06-next-turbopack-needs-client-boundaries-at-react-package-entrypoints.md
apps/www production build failed with a React Server Component error that
looked like a package-entry problem:
You're importing a module that depends on `useEffect` into a React Server Component module.
The reported files lived under packages/core/src/react/**, which made it
tempting to blame platejs/react.
That diagnosis was wrong.
The server-side registry route imports src/lib/rehype-utils.ts, and that file statically imports the generated registry index:
Once trailing-block-kit was added as a registry item, the generated index
started exposing:
That helper imports @platejs/suggestion/react, which pulls the React editor
graph into a server build path. Turbopack then reports the first hook-using
files it sees in packages/core/src/react/**.
The package entrypoint was only the messenger. The real bug was that a client-only helper became part of the server-visible registry graph.
'use client' to platejs/reactThat masks the bad import graph instead of removing it.
@platejs/core/react filesThat also masks the graph problem and broadens client boundaries for the wrong reason.
The page trace was real, but the decisive server-only signal was the registry route path:
Make trailing-block-kit a real client-only kit before exposing it through the
registry.
Concretely:
src/registry/components/editor/plugins/trailing-block-kit.tsx as a 'use client' fileSuggestionPlugin access inside that client boundaryEditorKit consume TrailingBlockKitsrc/registry/registry-kits.ts only after that boundary existsThe problem was not that trailing-block-kit existed. The problem was that it
was exposed as a server-visible registry item without declaring that it was
client-only.
The generated registry index is read by server code. Any registry item added there must either be server-safe or mark its own client boundary.
With 'use client' on trailing-block-kit.tsx, Turbopack stops treating that
helper as server-safe while keeping the kit available as registry surface.
These commands passed after converting the kit to a client-only registry item:
pnpm install
pnpm --filter ./apps/www build
pnpm turbo typecheck --filter=./apps/www
pnpm lint:fix