awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
920 stars 266 forks source link

An error occurs due to a dependency on React that is not needed #598

Closed fossamagna closed 3 years ago

fossamagna commented 3 years ago

When I use vue-cli to build vue-apollo, aws-appsync-auth-link, aws-appsync-subscription-link I get the following error:

This dependency was not found:

* react in ./node_modules/@apollo/client/react/context/ApolloConsumer.js, ./node_modules/@apollo/client/react/context/ApolloContext.js and 7 others

To install it, you can run: npm install --save react

If you install react, the error will disappear, but since react is not used, I would like to avoid installing it.

Probably because aa aws-appsync-auth-link and aws-appsync-subscription-link are importing @ apollo/client, so they also depend on react. Importing @apollo/client/core seems to fix it.

What is the expected behavior?

It is to eliminate the error without installing react.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

"dependencies": {
    "@apollo/client": "^3.2.5",
    "@vue/apollo-composable": "^4.0.0-alpha.12",
    "aws-appsync-auth-link": "^3.0.2",
    "aws-appsync-subscription-link": "^3.0.3",
    "core-js": "^3.6.5",
    "graphql": "^15.4.0",
    "graphql-tag": "^2.11.0",
    "register-service-worker": "^1.7.1",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  }