Skip to content

[graphiql] v4.0.1 gives tonz of import errors when using php #3919

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

Closed
1 task done
simPod opened this issue May 4, 2025 · 9 comments
Closed
1 task done

[graphiql] v4.0.1 gives tonz of import errors when using php #3919

simPod opened this issue May 4, 2025 · 9 comments

Comments

@simPod
Copy link

simPod commented May 4, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm using yarn v4 with PnP

graphiql v4.0.0 is ok

graphiql v4.0.1+ gives following errors

Could not resolve "graphql"

    ../.yarn/__virtual__/@graphiql-react-virtual-dad9d23c78/5/.yarn/berry/cache/@graphiql-react-npm-0.31.0-98df7f12cf-10c0.zip/node_modules/@graphiql/react/dist/explorer/components/doc-explorer.js:3:23:
      3 │ import { isType } from "graphql";
        ╵                        ~~~~~~~~~

  The Yarn Plug'n'Play manifest says this package has a peer dependency on "graphql", but the
  package "graphql" has not been installed:

    ../.pnp.cjs:2360:22:

Expected Behavior

No errors.

Steps To Reproduce

  1. Use Yarn with PnP
  2. import gql
  3. compile
import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql';

I have only such 2 imports -> gives 36 dependency errors

Environment

  • GraphiQL Version: 4.0.1
  • OS: macos
  • Browser: n/a
  • Bundler: vite
  • react Version: 19
  • graphql Version: 16

Anything else?

No response

@dimaMachina
Copy link
Collaborator

please provide runnable reproduction, so it could be fixed quickly

@dimaMachina
Copy link
Collaborator

dimaMachina commented May 4, 2025

Also, do you have graphql dependency installed? It has a required peerDependency

"peerDependencies": {
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",

@simPod
Copy link
Author

simPod commented May 4, 2025 via email

@dimaMachina
Copy link
Collaborator

ok, please provide a reproduction, so I could take a look at your issue

@simPod
Copy link
Author

simPod commented May 5, 2025 via email

@dimaMachina
Copy link
Collaborator

dimaMachina commented May 5, 2025

Here
simPod/graphiql-repro/actions/runs/14837669778/job/41652591875

Thanks, interesting, setting nodeLinker: node-modules in .yarnrc.yml doesn't throw an error

@simPod
Copy link
Author

simPod commented May 5, 2025

Yup, that's because it's softly resolved from node_modules and the import is satisfied even though the library does not explicitly declare it but some other irrelevant library does.

@dimaMachina
Copy link
Collaborator

dimaMachina commented May 5, 2025

It seems that patching GraphiQL's package.json files with yarn patch doesn't install new dependencies, so I'm unable to help you find a fix

@simPod
Copy link
Author

simPod commented May 5, 2025

The hotfix is

packageExtensions:
  "@graphiql/react@*":
    dependencies:
      "graphql": "*"
  "@graphiql/toolkit@*":
    dependencies:
      "graphql": "*"

I think the root issue is also this yarnpkg/yarn#7014

@simPod simPod closed this as completed May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants