Skip to content

Commit

Permalink
feat: add automatic RSC export, replacing /rsc bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Aug 31, 2024
1 parent bfb2756 commit d21eba6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 2 additions & 10 deletions apps/docs/pages/docs/integrating-puck/server-components.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# React Server Components

Puck provides **opt-in** support for [React Server Components](https://react.dev/reference/react/use-server#use-server) (RSC) via the included `rsc` bundle.
Puck provides out-of-the-box support for [React Server Components](https://react.dev/reference/react/use-server#use-server) (RSC).

The `rsc` bundle includes an RSC-friendly version of [`<Render>`](/docs/api-reference/components/render):

```tsx
import { Render } from "@measured/puck/rsc";

export function Page() {
return <Render config={config} data={data} />;
}
```
Because authoring with Puck dynamically renders components client-side, RSC is limited to the [`<Render>`](/docs/api-reference/components/render) component.

## DropZones and RSC

Expand Down
13 changes: 10 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"react-server": {
"import": "./dist/rsc.mjs",
"require": "./dist/rsc.js",
"types": "./dist/rsc.d.ts"
},
"default": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"./rsc": {
"import": "./dist/rsc.mjs",
Expand Down

0 comments on commit d21eba6

Please sign in to comment.