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

Ssr not picking up styled components from an npm package #4296

Open
Pixelatex opened this issue Apr 27, 2024 · 1 comment
Open

Ssr not picking up styled components from an npm package #4296

Pixelatex opened this issue Apr 27, 2024 · 1 comment

Comments

@Pixelatex
Copy link

I am serverside rendering a web app. (Using vite) Styled components works for any "native" components but when I import a simple button or so from an external component library I built, it will only pick up the styles for this on the client side.

I noticed that when I added the displayname true option to the babel plugin that only my native components were showing the names on the server.

Logging the initial style tags collected by the server stylesheet also doesn't show any component library classnames.

This leads me to think that somehow my serverside rendering is incapable of picking up the components.

What I tried:

  • verified that my library doesn't contain the styled or react libraries at build.

  • set an alias to point to the node_modules/styled

Does anyone have a vague idea what I am missing for this to work?

@quantizor
Copy link
Contributor

Are you certain that there is only one copy of styled-components being loaded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants