Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sub-component pattern cause error when used in React Server Components #4368

Open
joshblack opened this issue Mar 7, 2024 · 3 comments
Open
Labels
bug Something isn't working react

Comments

@joshblack
Copy link
Member

Description

When using a component that has a sub-component pattern, like PageLayout, the component is not able to be used in a React Server Component as it has the following error:

Error: Could not find the module ".../react/lib-esm/index.js#PageLayout#Header" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

Steps to reproduce

  1. Create an application using the app-router example

  2. Try to use PageLayout or other components that use the sub-component pattern in page.tsx

    import {PageLayout} from '@primer/react'
    
    export default function IndexPage() {
      return (
        <PageLayout>
          <PageLayout.Header>Header</PageLayout.Header>
          <PageLayout.Content>Content</PageLayout.Content>
        </PageLayout>
      )
    }
  3. Observe the error above

Version

v36.x

Browser

No response

@joshblack joshblack added bug Something isn't working react labels Mar 7, 2024
@joshblack
Copy link
Member Author

Note there are a couple of issues that have a similar error over in the Next.js repo: https://github.com/vercel/next.js/issues?q=is%3Aissue%20state%3Aopen%20could%20not%20find%20the%20module%20in%20the%20react%20client%20manifest

My guess is that it does not have a stable reference that it can refer to from the client-side bundle because we're doing a dynamic lookup on an export

@orangejx
Copy link

hiya,

Did you solve this problem? I have almost the same problem.

@orangejx
Copy link

hiya,

Did you solve this problem? I have almost the same problem.

like this problem,
#4069 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working react
Projects
None yet
Development

No branches or pull requests

2 participants