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

@graphql-tools/links requires react as dependency #4582

Open
4 tasks
AGrzes opened this issue Jul 20, 2022 · 1 comment
Open
4 tasks

@graphql-tools/links requires react as dependency #4582

AGrzes opened this issue Jul 20, 2022 · 1 comment

Comments

@AGrzes
Copy link

AGrzes commented Jul 20, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug
Version 8.3.0 requires react as dependency.

To Reproduce
Steps to reproduce the behavior:
For example import

import { createServerHttpLink } from '@graphql-tools/links'

And try to run without react on path
Expected behavior

Graphql tools are possible to run server side without react dependency.

Environment:

  • OS: Any
  • @graphql-tools/8.3.0:
  • NodeJS: Any

Additional context

It looks like d76a299 added

import * as apolloImport from '@apollo/client';

That triggers react dependency
@apollo/client/core should be used instead

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jul 24, 2022

@apollo/client is not a valid esm entry on Node.js as the exports map is missing. Thus, doing a deep import is not possible.

I changed this import within this pr in order to make the package usable on ESM. I already informed the apollo team about this in this comment exactly one month ago. So far there has not been any action and I am worried there won't be happening anything soon.

See these related issues that only got labeled...

We can change back this code once @apollo/client has a proper import map.


As an alternative, I propose you to nur use ApolloLinks on Node.js (there is IMHO no specific reason for using it), you can just use the http.request function or node-fetch@2.x.x.

@n1ru4l n1ru4l changed the title Version 8.3.0 requires react as dependency @graphql-tools/links requires react as dependency Feb 14, 2023
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

2 participants