Skip to content

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

Open
@joshblack

Description

@joshblack

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreactstaffAuthor is a staff member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions