Skip to content

Support graphql-js 17 (upgrade to Yoga v5 + make graphql a peer dependency) #42

Description

@jimmyhoran

Summary

With graphql-js v17 now stable, @elysiajs/graphql-yoga@1.4.1 can't be used in a v17 project. Two things in the current manifest block it:

// @elysiajs/graphql-yoga@1.4.1
"dependencies": {
  "graphql": "^16.6.0",        // hard-pins consumers to graphql 16
  "graphql-yoga": "^3.9.1"     // pulls in Yoga v3 (very old)
}

Because graphql is a regular dependency (not a peer), it can also install a second graphql runtime under the plugin even when the app already depends on graphql, producing the classic:

Cannot use GraphQLSchema "..." from another module or realm.

What this issue tracks

This is the umbrella for graphql-17 compatibility. It builds on two existing threads that each cover one piece but are currently unmerged:

Proposed changes

  1. Move graphql to peerDependencies with a widened range, e.g. ^16.6.0 || ^17.0.0 (ref Make graphql a peer dependency to avoid duplicate runtimes #40/Make graphql a peer dependency #41). This fixes the duplicate-runtime error and lets the host app own the graphql version.
  2. Upgrade graphql-yoga to ^5 (ref build(deps): bump graphql-yoga from 3.9.1 to 5.10.4 #39). v3 is several majors behind.
  3. Track upstream: full graphql-17 support ultimately depends on graphql-yoga itself adding a ^17 peer range (see graphql-hive/graphql-yoga). Once that lands, this package's peer/Yoga ranges can include it end-to-end.

Offer

Happy to open a PR combining the peer-dependency move and the Yoga v5 bump if that's a welcome direction.

Environment

  • @elysiajs/graphql-yoga: 1.4.1
  • target: graphql@17.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions