graphiql
graphiql copied to clipboard
Instruct all graphiql/toolkit users to install graphql-ws
seems it breaks my builds with
Module not found: Error: Can't resolve 'graphql-ws' in '/proj/node_modules/@graphiql/toolkit/esm/create-fetcher'
i don't use graphql-ws directly but the fetcher as described in doc
import { createGraphiQLFetcher } from '@graphiql/toolkit'
const fetcher = createGraphiQLFetcher({
url: '/graphql',
})
would pin point the breakage here https://github.com/graphql/graphiql/commit/c36504a804d8cc54a5136340152999b4a1a2c69f BC graphql-ws was included by graphql-config which is not true anymore?
Thanks for the work here :)
graphql-ws
is a peer dependency if you check the readme. if we marked a specific version of graphql-ws
in dependencies
it would break people's implementations
@enisdenjo do you think we should just depend on the latest version of graphql-ws
, or keep graphql-ws
as a peer dep?
it's less than ideal that non-wss users have to install it for our fetcher, though.
perhaps we can re-architect the createGraphiQLFetcher
to allow "plugins", just worried that would send us down a path of complexity.
@dotansimha and @timsuchanek what do you think?
I'd suggest leaving it as a peer dep, absolutely no need to push a new version of @graphiql/toolkit
everytime graphql-ws
updates.
so i should include it in my package.json even though i don't use it directly?
@eMerzh for now, yes, sorry. this is generally the case for all peerDependencies
of graphiql
. we may be able to re-architect the toolkit to accomodate non-wss users
š thanks for the help š
it would probably help to make it as explicit code dependancy like in examples with createGraphiQLFetcher using a "simple" client ... to make it clearer. anyway, you can close this if you want :)
I'd also say we keep it as a peer dependency for now, but then revisit this topic once we're looking at a more elaborate plugin system targeting v2.
I'll close this for now, as it seems to be resolved in this case.
Iām reopening until we resolve this ticket by updating the docs at least.
@eMerzh agreed, I think we need to update several markdown files with these instructions
Related: https://github.com/graphql/graphiql/issues/2405
I found a much better solution to this problem!
peerDependenciesMeta
allows you to specify which peer dependencies are optional
The latest version (@graphiql/[email protected]
) now specifies graphql-ws
as optional peer dependency