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

Conflicting @emotion/react #141

Open
medihack opened this issue Jun 26, 2022 · 14 comments
Open

Conflicting @emotion/react #141

medihack opened this issue Jun 26, 2022 · 14 comments
Labels
enhancement New feature or request

Comments

@medihack
Copy link
Contributor

My app uses Mantine component library, which uses Emotion under the hood. But it seems React Hook Form DevTools also uses Emotion, but a different version. When I add DevTools to my app, I now get the following warning on the console:

You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.

Should I ignore it, or is there a way to make DevTools more "sandboxed"?

@bluebill1049
Copy link
Member

What's the version difference? maybe we can upgrade to the latest if that's the issue, but it's a devtool so it's not bundle into your prod code, so i wouldn't worry too much about it.

@medihack
Copy link
Contributor Author

Mantine v5 currently uses @emotion/react version 11.9.3. As DevTools is often used with other component UI libraries (and Emotion is a very common style library) wouldn't it make sense to declare Emotion as a peer dependency in DevTools? But maybe you are right, and I should just ignore the warnings.

@bluebill1049
Copy link
Member

I think it's fine to ignore.

@bluebill1049 bluebill1049 added the enhancement New feature or request label Jul 1, 2022
@medihack
Copy link
Contributor Author

medihack commented Jul 2, 2022

Yes, I will ignore it. But there are also some discussions in the Emotion repo itself if @emotion/react is better added as a peer dependency.

emotion-js/emotion#2343 (comment)
emotion-js/emotion#2795 (reply in thread)

Even Mantine seems to switch mantinedev/mantine#1715

@bluebill1049
Copy link
Member

oh i see, would you like to send a PR to adjust that? happy to re-release if that will resolve the issue.

@medihack
Copy link
Contributor Author

medihack commented Jul 3, 2022

Sure, it is as easy as moving the dependency line to peer dependencies. As version restriction, I would use "@emotion/react": ">=11.0.0". I will open a PR.

medihack added a commit to medihack/devtools that referenced this issue Jul 3, 2022
bluebill1049 pushed a commit that referenced this issue Jul 3, 2022
Fixes Conflicting @emotion/react #141
@bluebill1049
Copy link
Member

this caused issue: https://codesandbox.io/s/react-hook-form-get-started-ts-forked-o1ebc5?file=/src/index.tsx Will revert that commit for now.

@medihack
Copy link
Contributor Author

medihack commented Jul 4, 2022

Sure, I will investigate what's wrong here. Sorry for the trouble.

@bluebill1049
Copy link
Member

not at all, thanks for contributing and helping. 🙏

@medihack
Copy link
Contributor Author

this caused issue: https://codesandbox.io/s/react-hook-form-get-started-ts-forked-o1ebc5?file=/src/index.tsx Will revert that commit for now.

I took another look into this. This import is a bit strange: import { DevTool } from "./src";.
Shouldn't it be: import { DevTool } from "@hookform/devtools";?

Also, there is no "@emotion/react" in the dependencies of the linked CodeSandbox (but one has to, as it is a peer dependency). I wonder if it was more a problem of the CodeSandbox example.

@bluebill1049
Copy link
Member

oops, you are right... was using a CSB reference to src folder i will revert (revert) your merge

@bluebill1049
Copy link
Member

bluebill1049 commented Jul 24, 2022

never mind, it's already released, I didn't revert your original commit. could you verify it's working?

@medihack
Copy link
Contributor Author

medihack commented Jul 27, 2022

never mind, it's already released, I didn't revert your original commit. could you verify it's working?

It seems reverted as @emotion/react is still a direct dependency in master branch and not a peer dependency.

@bluebill1049
Copy link
Member

oops, would like you to push your PR again? let's remerge it?

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

No branches or pull requests

2 participants