Skip to content

Theme is empty when importing component outside the Gatsby root #1479

@moroshko

Description

@moroshko

I'm building a component library alongside a Gatsby demo website. The component library is styled with Emotion + theming.

Here is the basic folder structure I have:

src
  components
    button.js
website
  src
    components
      layout.js
    pages
      index.js

My problem is that the button doesn't get the theme (the theme appears to be {}).

However, if I move the button to website/src/components, the theme gets to the button as expected.

See repro here.

What am I missing here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions