vercel / next-react-server-components

Demo repository for Next.js + React Server Components
https://next-rsc-hn.vercel.app
MIT License
979 stars 158 forks source link

Non-page server component cannot import client component #7

Closed zaiste closed 2 years ago

zaiste commented 2 years ago

It seems that client components can be only directly imported from a page component.

For example, the News component located in rsc.server.js can import the Story client component just fine. If we, however, move the StoryWithData to a separate file (with the .server suffix or none i.e. a shared component), Next.js returns errors.

Here's a diff off a branch from my fork that shows this issue: https://github.com/vercel/next-rsc-demo/compare/main...zaiste:non-page-server-comp-cannot-import-client-comp

shuding commented 2 years ago

Thanks for reporting! I can reproduce this bug and we're working on a fix.

zaiste commented 2 years ago

@shuding thanks for a speedy fix. You rock!

shuding commented 2 years ago

Should be fixed in latest next@canary 🎉