question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem of package development using GraphQL

See original GitHub issue

I develop a package that uses graphql. It has peerDeps:

"peerDependencies": {
    "@types/graphql": "~0.10.4 || ~0.11.0 || ~0.12.0 || ~0.13.0",
    "graphql": "~0.10.4 || ~0.11.0 || ~0.12.0 || ~0.13.0"
  }

Using standart package development flow, I make a repo of this package, link it with yarn link, then go to test project and add it via yarn link package/name.

And on printSchema in the package I get:

Error: Cannot use GraphQLObjectType "__Directive" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

resolutions in both packages don’t work.

And I see no options to suppress this behavior.

I think that there should be such option, to suppress this check on such cases (maybe via env variable or something else), in other case I don’t understand, how to develop and check packages locally

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
IvanGoncharovcommented, May 25, 2018

So they, are in different places and have different node_modules

@terion-name I see. I can’t think of any good solution to this problem that we could implement inside graphql-js 😞 Possible workaround: copy node_modules/graphql somewhere and run yarn link in it and also link it in two projects you mentioned.

1reaction
terion-namecommented, May 25, 2018

@leebyron resolutions doesn’t work. because, as I’ve written, I am linking a package that is in develop to project it is developed for via yarn link. So they, are in different places and have different node_modules

Read more comments on GitHub >

github_iconTop Results From Across the Web

Five Common Problems in GraphQL Apps (And How to Fix ...
Schema duplication; Server/client data mismatch; Superfluous database calls; Poor performance; Boilerplate overdose. I'm willing to bet your app ...
Read more >
GraphQL performance explained - Medium
Performance problems are often one of the reasons why developers avoid adopting GraphQL API. First Google search results that will appear ...
Read more >
GraphQL vs. REST APIs: Why you shouldn't use GraphQL
We'll discuss the drawbacks of using GraphQL, including performance issues, problems with GraphQL schemas, and complex queries.
Read more >
Full Stack Error Handling with GraphQL and Apollo
As a front-end developer, I would like to display rich error feedback in the UI to empower my users to fix their own...
Read more >
GraphQL Advantages and Disadvantages - Javatpoint
It unifies them and hides their complexity. The GraphQL server is also used to fetch data from the existing systems and package it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found