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

Add @emotion/[email protected] as a peer dependency #115

Merged
merged 6 commits into from
May 6, 2022

Conversation

csandman
Copy link
Owner

@csandman csandman commented May 6, 2022

This starts with #73 which points out that when multiple instances of @emotion/react are installed, you receive the following warning:

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.

Before [email protected], the versions of @emotion/react required by Chakra UI and React Select were largely compatible (^11.0.0 vs. ^11.1.1). In the most recent version of react-select however, they bumped their @emotion/react dependency to ^11.8.1, the third most recent version. This means that it is far more likely that users of this package will run into issues with having multiple versions of @emotion/react.

The easiest way to prevent multiple versions of @emotion/react from being installed and this error being thrown is by keeping your project's dependency for @emotion/react at least as high as the minimum version required by both of these packages. This will allow the NPM cli to de-dupe the package, removing this warning. In order to ensure that this happens, @emotion/react will now be included as a peer dependency, with the minimum version set to the lowest common version across Chakra UI and React Select.

If you're running into this error, run one of the following commands to install a compatible version of @emotion/react:

# If using npm:
npm i @emotion/react@^11.8.1
# ...or...
npm i @emotion/react@latest

# If using yarn
yarn add @emotion/react@^11.8.1
# ...or...
yarn add @emotion/react@latest

If for any reason you can't update your package to use @emotion/[email protected], you can install this package using the --legacy-peer-deps flag, but it's not the preferred way to go.

npm i --legacy-peer-deps chakra-react-select

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

Successfully merging this pull request may close these issues.

[BUG] You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems.
2 participants