Repository navigation
1.8.1
Neba could not be imported into a React Server Component, and nothing in this repository could have said so. React's react-server build does not export useState, useEffect, useRef, useContext or createContext at all, so the fifty-three modules here that called one were a TypeError in someone's Next.js app rather than a component that rendered badly — and every check stayed green, because nothing here renders on a server.
Fixed
- Every component is a client component and now says so.
'use client'on all ninety-nine component files, and on the seven modules underinternal/that hold a context or an effect. Importing one into a Server Component works, with no wrapper of your own and notranspilePackagesentry. The directive marks a boundary rather than a page: a Server Component that renders aButtonstays a Server Component, and only the components it renders reach the browser. What has not changed is the ordinary rule about that boundary — an event handler defined in a Server Component still cannot be passed across it. - All of them, and not only the ones that hold state today. Thirteen components would technically have survived a server render; eight of those are Base UI form controls that go inside a client boundary anyway, and the other five are one prop from failing, since
transitionis auseLayoutEffectandrenderis Base UI'suseRenderand nearly every component in the library already takes one or the other. A per-component answer would be a table that rots. It costs nothing measurable either: everynpm run sizescenario is unchanged to the byte, because a bundler hoists the directive rather than shipping it a hundred and six times. - The
nebabarrel, the component barrels andneba/localesare deliberately left unmarked, and each would break if they were not. A barrel only re-exports, so unmarked it belongs to whichever graph imports it and a Server Component importingnebareaches the client modules behind it rather than a boundary of its own.registerMessagesstays a plain function for the same shape of reason: marked, it would arrive in a consumer's server module as a client reference instead of a function and throw when called. terser.config.jsonsetscompress.directives: false, which is the half of this that would otherwise have failed silently.directivesremoves "redundant or non-standard" directives, and in a module — whereuse strictis implied — terser readsuse clientas both, stripping it out of all one hundred and six files without a word. The published package would have said nothing at all to Next.js while every check here still passed. It isoutput.preserve_annotations' twin: two settings, each keeping one thing terser eats on the way out.
Documentation
- Next.js and React Server Components, a new section in Getting started in both locales: what the directive does and does not do, why a handler written in a Server Component cannot be passed to a
Button, where the stylesheet is imported in an App Router project, and how to register a language from a module that is in the client graph.'use client'is a string at the top of a file, so Vite, webpack, Remix, Astro and plain React ignore it and nothing above changes what the package does there. The README carries the short form. test/package/resolution.test.tsgains four checks, since this is exactly the kind of invariant that is invisible here and expensive in someone else's project: that every component starts with the directive, that every module calling a client-only React API does too, that the barrels and the locales do not, and that the terser setting holding it all up is still there.CLAUDE.mdrecords the rule and its three deliberate exemptions.
Every release is in the changelog on the docs site and in CHANGELOG.md at this tag.