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

core and ui-react trying to force react-native and react 18 deps #1621

Closed
2 tasks done
revmischa opened this issue Apr 5, 2022 · 4 comments
Closed
2 tasks done

core and ui-react trying to force react-native and react 18 deps #1621

revmischa opened this issue Apr 5, 2022 · 4 comments
Labels
Authenticator An issue or a feature-request for an Authenticator UI Component pending-response Issue is pending response from the issue requestor React Native An issue or a feature-request for React Native platform React An issue or a feature-request for React platform

Comments

@revmischa
Copy link

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Authenticator

How is your app built?

Next.js

Please describe your bug.

I'm trying to use amplify for handling the frontend of cognito auth. It works fine but the dependencies it pulls in cause some problems. For example it really wants me to install React 18:

npm WARN While resolving: use-subscription@1.6.0
11:16:35.508 | npm WARN Found: react@17.0.2
11:16:35.508 | npm WARN node_modules/react
11:16:35.508 | npm WARN   peer react@"^0.14.9 \|\| ^15.3.0 \|\| ^16.0.0" from react-motion@0.5.2
11:16:35.508 | npm WARN   node_modules/@nivo/colors/node_modules/react-motion
11:16:35.508 | npm WARN     react-motion@"^0.5.2" from @nivo/colors@0.72.0
11:16:35.508 | npm WARN     node_modules/@nivo/colors
11:16:35.508 | npm WARN
11:16:35.508 | npm WARN Could not resolve dependency:
11:16:35.508 | npm WARN peer react@"^18.0.0" from use-subscription@1.6.0
11:16:35.509 | npm WARN node_modules/use-subscription
11:16:35.509 | npm WARN   use-subscription@"^1.3.0" from @xstate/react@1.6.3
11:16:35.509 | npm WARN   node_modules/@xstate/react
11:16:35.509 | npm WARN   1 more (react-native)
11:16:35.509 | npm WARN
11:16:35.509 | npm WARN Conflicting peer dependency: react@18.0.0
11:16:35.509 | npm WARN node_modules/react
11:16:35.509 | npm WARN   peer react@"^18.0.0" from use-subscription@1.6.0
11:16:35.509 | npm WARN   node_modules/use-subscription
11:16:35.509 | npm WARN     use-subscription@"^1.3.0" from @xstate/react@1.6.3
11:16:35.509 | npm WARN     node_modules/@xstate/react
11:16:35.509 | npm WARN     1 more (react-native)

...

platform@1.0.0 /Users/cyber/dev/platform
└─┬ frontend@0.5.0 -> ./packages/frontend
  └─┬ @aws-amplify/ui-react@2.13.0
    └── @xstate/react@1.6.3

Also, separately, @aws-amplify/core is pulling in react-native which I really don't want:

platform@1.0.0 /Users/cyber/dev/platform
└─┬ frontend@0.5.0 -> ./packages/frontend
  └─┬ @aws-amplify/core@4.5.0
    └─┬ @aws-sdk/client-cloudwatch-logs@3.6.1
      └─┬ @aws-sdk/middleware-retry@3.6.1
        └─┬ react-native-get-random-values@1.7.2
          └─┬ react-native@0.68.0
            └─┬ @react-native-community/cli@7.0.3
              └── react-native@0.68.0 deduped

What's the expected behaviour?

Not try to force React 18 or react-native just to get the amplify/react package.

Help us reproduce the bug!

npm i npm>=7.0.0
npm i react@^17.0.0
npm i @aws-amplify/ui-react@2.13.0 (get mad warnings)

npm ls react-native

Code Snippet

// Put your code below this line.

Additional information and screenshots

No response

@Milan-Shah Milan-Shah added the pending-triage Issue is pending triage label Apr 5, 2022
@calebpollman
Copy link
Contributor

Hi @revmischa the issue with @aws-amplify/core bringing in react-native as a dependency is being tracked here.

Regarding the peerDeps of use-subscription attempting to bring in react@18 in your project, assuming you are just trying to get rid of the warnings during installation, with npm >= 8.3 you can leverage the overrides field in your package.json to explicitly set use-subscription@1.5.1 (which has a react peerDep of ^16.8.0 || ^17.0.0) and meets the required version of use-subscription required by @xstate/react (which is ^1.3), e.g.

"overrides": {
    "use-subscription": "1.5.1"
}

@calebpollman calebpollman added pending-response Issue is pending response from the issue requestor and removed pending-triage Issue is pending triage labels Apr 5, 2022
@reesscot reesscot added Authenticator An issue or a feature-request for an Authenticator UI Component React An issue or a feature-request for React platform React Native An issue or a feature-request for React Native platform labels Apr 5, 2022
@revmischa
Copy link
Author

Cool thanks

@revmischa
Copy link
Author

Hi @revmischa the issue with @aws-amplify/core bringing in react-native as a dependency is being tracked here.

Oh yeah looks like I opened that six months ago lol

@calebpollman
Copy link
Contributor

@revmischa Unless you have an objection, closing this ticket since there is not much we can do for the use-subscription peerDeps and the react-native issue is being tracked by the owning team. Feel free to reopen though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Authenticator An issue or a feature-request for an Authenticator UI Component pending-response Issue is pending response from the issue requestor React Native An issue or a feature-request for React Native platform React An issue or a feature-request for React platform
Projects
None yet
Development

No branches or pull requests

4 participants