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.

Emotion 10 + Emotion 11 side-by-side problems

See original GitHub issue

Current behavior:

I’m currently attempting an upgrade of our codebase to Emotion 11 and it’s proving extremely problematic as we have a variety of things that still require Emotion 10. (e.g. storybook). So I have a node_modules folder that contains both Emotion 10 and Emotion 11.

There are some TypeScript issues (specifically the dreaded TS2742 error) which I won’t list here but the most significant problem I’m having right now is with the versioning of the @emotion/serialize package: the Emotion 10 version of this package has a higher version number than the Emotion 11 version and so is picked up by @emotion/react of Emotion 11.

To reproduce:

  1. Create a lerna repo and install storybook at the top level. That uses Emotion 10
  2. Create a subpackage that uses Emotion 11’s @emotion/react package.
  3. Try to use the Emotion 11 package; it won’t work because it picks up @emotion/serialize@0.11.16 from Emotion 10, used by storybook.

The problem is that @emotion/react@11.0.0-next.14 has a dependency on ^0.11.15-next.2. That dependency will be satisfied by @emotion/serialize@0.11.16

Expected behavior:

If Emotion 11 packages require other Emotion 11 packages, they should be picking them up, not accidentally picking up Emotion 10 packages.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Andaristcommented, Nov 8, 2021
0reactions
levymetalcommented, Nov 7, 2021

I’m getting a similar issue with a project that uses Emotion 11 and Storybook 6 (which uses Emotion 10). @emotion/sheet@0.9.4 from @storybook#theming#@emotion#core#@emotion#cache gets hoisted to @emotion/sheet, and Emotion 11 pulls that instead of @emotion/sheet@^1.0.3 throwing a TypeError: cache.sheet.hydrate is not a function. Manually adding @emotion/sheet@^1.0.3 to the package hoists it to @emotion/sheet.

This only happens with yarn and not npm. However, I don’t understand why Emotion 11 breaks with this hoisting strategy; I don’t understand why it’s pulling sheet from the root instead of its own deps. The node_modules dir in @emotion/react contains the correct version of sheet.

I’ve created a repro here: https://github.com/levymetal/emotion-11-conflict-repro. Running yarn start throws the TypeError above. Removing @storybook/react or adding @emotion/sheet@^1.0.3 fixes the 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 Ultimate List of Emotions and How to Control Your Emotions
Despite the millennia we have spent side by side with our emotions as we evolved, it can be difficult to really identify, understand,...
Read more >
Attentional capture in emotion comparison is orientation ...
Beyond an overall facilitation for upright relative to inverted pairs, results showed orientation independent ESC and emotional size effects.
Read more >
Reduced differentiation of emotion-associated bodily ...
Reduced emotion differentiation in autism may be related to the affective challenges that autistic people are more likely to experience, including anxiety and ......
Read more >
Mindfulness, Emotions, and Ethics: The Right Stuff?
as the unruly step-child of the problem-solving mind.6 They warn that untamed emotion ... 7-JUL-10. 11:53. Spring 2010]. MINDFULNESS, EMOTIONS, AND ETHICS.
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