What is the problem this feature would solve?
@elysiajs/graphql-yoga currently declares graphql as a regular dependency. In real apps, that can install a second graphql runtime underneath the plugin even when the application already depends on graphql directly.
That creates the classic runtime mismatch where a schema is created with one graphql instance and consumed by Yoga with another, producing errors like:
Cannot use GraphQLSchema "..." from another module or realm.
In practice, this can break the GraphQL route entirely even though the app and plugin are both using GraphQL 16.
What is the feature you are proposing to solve the problem?
Make graphql a required peer dependency of @elysiajs/graphql-yoga instead of a regular dependency.
Concretely:
- move
graphql from dependencies to peerDependencies
- keep
graphql in devDependencies for this repo's own build and tests
- document that consuming apps should install both
@elysiajs/graphql-yoga and graphql
That would let the application own the GraphQL runtime and avoid duplicate module instances.
I opened #41 as a working example of this packaging change.
What alternatives have you considered?
- Add a new runtime injection API so users can manually supply their own GraphQL/Yoga implementation.
- This seems heavier than needed because the problem appears to be package ownership, not missing runtime hooks.
- Upgrade
graphql-yoga as part of the fix.
- Useful separately, but it does not address the core issue if this package still owns its own
graphql dependency.
- Keep the current dependency layout.
- This leaves consumers exposed to duplicate-runtime failures in package managers that keep both copies installed.
What is the problem this feature would solve?
@elysiajs/graphql-yogacurrently declaresgraphqlas a regular dependency. In real apps, that can install a secondgraphqlruntime underneath the plugin even when the application already depends ongraphqldirectly.That creates the classic runtime mismatch where a schema is created with one
graphqlinstance and consumed by Yoga with another, producing errors like:In practice, this can break the GraphQL route entirely even though the app and plugin are both using GraphQL 16.
What is the feature you are proposing to solve the problem?
Make
graphqla required peer dependency of@elysiajs/graphql-yogainstead of a regular dependency.Concretely:
graphqlfromdependenciestopeerDependenciesgraphqlindevDependenciesfor this repo's own build and tests@elysiajs/graphql-yogaandgraphqlThat would let the application own the GraphQL runtime and avoid duplicate module instances.
I opened #41 as a working example of this packaging change.
What alternatives have you considered?
graphql-yogaas part of the fix.graphqldependency.