question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing styles in production (CRA + Emotion 11)

See original GitHub issue

Current behavior:

Successfully updated codebase to emotion 11 (from 9) and using the css prop in conjunction with craco to override the webpack config and use the @emotion/babel-preset-css-prop preset. When running locally in development, all styles are applied properly and everything looks good. When building for production however, it seems like there are styles missing throughout the app.

To reproduce:

I don’t have a repro case as this is in app, I’m hoping I’ve just missed a step or something else obvious.

Environment information:

  • react version: 17.0.1
  • @emotion/react version: 11.1.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Andaristcommented, Jan 13, 2021

I guess my question now becomes, is there any easy way to safely use @emotion/css alongside @emotion/react?

Yes. The exact thing I was suspecting is multiple instances of the @emotion/cache module - @emotion/css & @emotion/react shares that dependency. It’s hard to tell what exactly has been wrong without inspecting a repro case. If the version of that @emotion/cache will be the same then there shouldn’t be any problem.

1reaction
NicholasBollcommented, May 7, 2021

Does #2361 fix this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Emotion 11
Emotion 11 is a slight evolution over the Emotion 10. It focuses mainly on the developer experience, TS types improvements, switches internals to...
Read more >
the `@emotion/core` package has been renamed to ... - You.com
Apparently in Emotion 11, @emotion/core was renamed to @emotion/react, but since no version was specified when installing in yarn, @emotion/styled depends ...
Read more >
How To Use Emotion for Styling in React | DigitalOcean
Learn how to style components in React using the emotion CSS-in-JS library. ... @emotion/react v11.1.4, and @emotion/styled v11.0.0.
Read more >
Releases - styled-components
Add missing typeof window check when checking for duplicate instances of styled-components ... Fix React Native components accepts function as style prop.
Read more >
emotion css feature is not rendering the styles (React)
and no single quote at 'bold' , it is not valid css writing style ... with create-react-app using @emotion/react 11, React 18, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found