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 · 4 comments
Open
Labels
bug Something isn't working react staff Author is a staff member

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)

Copy link
Contributor

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 16, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
@joshblack joshblack reopened this Jan 23, 2025
@joshblack joshblack removed the Stale label Jan 23, 2025
@github-actions github-actions bot added the staff Author is a staff member label Jan 23, 2025
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 staff Author is a staff member
Projects
None yet
Development

No branches or pull requests

2 participants