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

Emotion versioning #522

Closed
codylawson opened this issue Dec 17, 2018 · 11 comments
Closed

Emotion versioning #522

codylawson opened this issue Dec 17, 2018 · 11 comments

Comments

@codylawson
Copy link

codylawson commented Dec 17, 2018

Bug Report

Emotion version seems to be inconsistent

I'm getting import errors in npm around @emotion/, specifically some referenced classes. @emotion/core and @emotion/styled seem to be pulling incompatible versions. I don't see a peer dependency for emotion in the docs but adding v10.0.5 of @emotion/core and @emotion/styled seems to fix the problem.

Perhaps I'm just missing the part of the docs or package.json where it's a peer dependency?

To Reproduce

  1. Delete package-lock.json and node_modules
  2. npm i docz docz-theme-default
  3. npm run docz:dev

The import errors I'm seeing without @emotion as a dependency:

./node_modules/docz-theme-default/dist/index.m.js
Attempted import error: 'ClassNames' is not exported from '@emotion/core'.

./node_modules/emotion-theming/dist/emotion-theming.browser.esm.js
Attempted import error: 'ThemeContext' is not exported from '@emotion/core'.

./node_modules/emotion-theming/dist/emotion-theming.browser.esm.js
Attempted import error: 'ThemeContext' is not exported from '@emotion/core'.

./node_modules/emotion-theming/dist/emotion-theming.browser.esm.js
Attempted import error: 'ThemeContext' is not exported from '@emotion/core'.

The warnings when I have emotion/core and emotion/styled as depdencies:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @emotion/styled-base@0.10.6 requires a peer of @emotion/core@0.x.x but none is installed. You must install peer dependencies yourself.
npm WARN @emotion/styled-base@0.10.6 requires a peer of @emotion/core@0.x.x but none is installed. You must install peer dependencies yourself.
npm WARN @emotion/styled-base@0.10.6 requires a peer of @emotion/core@0.x.x but none is installed. You must install peer dependencies yourself.
npm WARN react-docgen-typescript-loader@2.2.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN @emotion/provider@0.11.2 requires a peer of @emotion/core@0.x.x but none is installed. Youmust install peer dependencies yourself.
npm WARN react-treebeard@3.1.0 requires a peer of @emotion/styled@^0.10.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-docgen-typescript-loader@3.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

The documentation is compiled successfully with these warnings.

Expected behavior

Should emotion be documented as a peer dependency?

Environment

  • OS: OSX 10.14.1
  • Node/npm version: Node 10.13.0/npm 6.5.0
  • docz / docz-theme-default: ^0.13.2

Additional context/Screenshots

Forgive me if this is off base..

@nerdmax
Copy link

nerdmax commented Jan 1, 2019

I also get this warning for docz@0.13.7

Attempted import error: 'isBrowser' is not exported from '@emotion/utils'.

Installing @emotion/core and @emotion/styled doesn't fix it. I also tried installing @emotion/utils. Still not working.

PS: My project has dep emotion@10.0.0. I think this may cuase the issue.

@Stevo14850
Copy link

Stevo14850 commented Jan 1, 2019

@nerdmax try installing @emotion/cache.

I had this problem yesterday and assuming we had the same error then there should be a line before that message you pasted saying that the import is happening inside of something like @emotion/cache/....

Hope that works for you.

@nerdmax
Copy link

nerdmax commented Jan 1, 2019

@Stevo14850 Thank you so much! Your solution works perfectly! Really appreciate it!

@Stevo14850
Copy link

Glad it worked or you @nerdmax! 🎉

You @ed the wrong Steven btw. 😆

@nerdmax
Copy link

nerdmax commented Jan 1, 2019

😅Thank you for your reminding.

@codylawson
Copy link
Author

@pedronauck Why was this closed? It seems to still be an issue with the latest release.

@rot1024
Copy link

rot1024 commented Jan 7, 2019

In my project and docz v0.13.7, this error still prevents updating modules and yarn.lock. Clearing node_modules and yarn.lock, or installing @emotion/cache, or using npm instead of yarn doesn't work.

@nerdmax
Copy link

nerdmax commented Jan 17, 2019

In my project and docz v0.13.7, this error still prevents updating modules and yarn.lock. Clearing node_modules and yarn.lock, or installing @emotion/cache, or using npm instead of yarn doesn't work.

Have you tried installing @emotion/core and @emotion/styled ?

@rot1024
Copy link

rot1024 commented Jan 17, 2019

Yes, @emotion/core and @emotion/styled have already installed.

However that issue is already been cleared up.

  1. Install and save @emotion/cache
  2. Regenerate yarn.lock: rm yarn.lock && yarn
  3. Docz works well

But it is strange as actually @emotion/cache should not be necessary to install...

@jwilson64
Copy link

I came across this and it ended up that I needed to add a bunch of emotion things plus docz-default-theme.

This feels like it shouldn't be something we need to install as a requirement of another library but here is what fixed it for me:

"docz": "0.13.7",
"docz-theme-default": "^0.13.7",
"@emotion/cache": "^10.0.0",
"@emotion/core": "^10.0.6",
"@emotion/styled-base": "^10.0.5",

hope this helps anyone else coming across it.

@nerdmax
Copy link

nerdmax commented Jan 19, 2019

Yes, @emotion/core and @emotion/styled have already installed.

However that issue is already been cleared up.

  1. Install and save @emotion/cache
  2. Regenerate yarn.lock: rm yarn.lock && yarn
  3. Docz works well

But it is strange as actually @emotion/cache should not be necessary to install...

Agreed! Don't know why @emotion/cache needs to be installed.

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

6 participants