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

Using emotion 9 and 10 in the same window #1347

Closed
paul-sachs opened this issue May 14, 2019 · 9 comments
Closed

Using emotion 9 and 10 in the same window #1347

paul-sachs opened this issue May 14, 2019 · 9 comments

Comments

@paul-sachs
Copy link

paul-sachs commented May 14, 2019

  • emotion version: 9.2.12 AND 10.0.10
  • react version: 16.8.6

What you did:

Trying to use an emotion 9 lib within storybook v5.

What happened:

Error is thrown on load:

Uncaught TypeError: Cannot read property 'length' of undefined
    at serializeStyles (main.3173126555acebfe0d1a.bundle.js:445)
    at css (vendors~main.ad7bd95803918bf0d539.bundle.js:643)
    at Module.keyframes (vendors~main.ad7bd95803918bf0d539.bundle.js:504)
    at Object../node_modules/@storybook/theming/dist/animation.js (vendors~main.ad7bd95803918bf0d539.bundle.js:7687)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at Object../node_modules/@storybook/theming/dist/create.js (vendors~main.ad7bd95803918bf0d539.bundle.js:7845)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at Object../node_modules/@storybook/theming/dist/index.js (vendors~main.ad7bd95803918bf0d539.bundle.js:8126)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at Object../node_modules/@storybook/router/dist/visibility.js (vendors~main.ad7bd95803918bf0d539.bundle.js:7643)

See for a little additional detail:

storybookjs/storybook#6337

Expectation:

Two different webpacks (one with 10.x and one for 9) should behave properly on the same window.

@FezVrasta
Copy link
Member

Would you be able to provide a reproducible example? Possibly on CodeSandbox

@paul-sachs
Copy link
Author

paul-sachs commented May 15, 2019 via email

@FezVrasta
Copy link
Member

You should be able to use CodeSanbox Containers:
https://hackernoon.com/codesandbox-containers-5864a8f26715

I also found this CodeSandbox that runs Storybook:
https://codesandbox.io/s/github/libetl/storybook-to-codesandbox-test

@paul-sachs
Copy link
Author

paul-sachs commented May 15, 2019 via email

@IsenrichO
Copy link

I ran into a similar issue recently. Are you using yarn workspaces too by chance?

@paul-sachs
Copy link
Author

paul-sachs commented May 15, 2019 via email

@IsenrichO
Copy link

Workspaces hoists your dependencies and then leads to an issue because of different major versions of emotion. I had to upgrade to emotion v10 and storybook v5 together unfortunately. Would also be curious if there's a better approach though.

@qoalu
Copy link

qoalu commented Jun 5, 2019

Not using workspaces and having the issue as well.
We decided to move to styled-components instead in our project (same api, no conflicts)

@Andarist
Copy link
Member

Closing this because we have not received enough information for a long time to be able to look at this.

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

No branches or pull requests

5 participants