Open ghry5 opened 4 years ago
I have attempted to use graphql-configs pluckConfig to use 'gql' for my first project (hasura) and 'graphql' for gatsby. The config works for graphql-codegen ('graphql' tags are being ignored successfully)
projects:
default:
schema: 'http://localhost:6060/v1/graphql'
documents:
- src/**/*.{graphql,gql,ts,tsx}:
pluckConfig:
globalGqlIdentifierName: 'gql'
modules:
- name: '@apollo/client'
identifier: 'gql'
extensions:
codegen:
overwrite: true
generates:
src/generated/graphql.tsx:
plugins:
- 'typescript'
- 'typescript-operations'
- 'typescript-react-apollo'
./graphql.schema.json:
plugins:
- 'introspection'
gatsby:
schema: 'http://localhost:8000/___graphql'
documents:
- src/**/*.{ts,tsx}:
pluckConfig:
globalIdentifier: 'graphql'
globalGqlIdentifierName: 'graphql'
modules:
- name: 'gatsby'
identifier: 'graphql'
Sadly vscode still reports my gatsby queries which use import {graphql} from 'gatsby'
as an error. Inside said tags i get autocompletion for my default (hasura) api.
I had no idea about pluckConfig
. Unfortunately it takes a lot more than just upgrading graphql config
I am using multiple different graphql APIs which I have registered in my graphql-config file as different named projects. Using external *.projectX.gql files works quite nicely.
Is there any way to use the gql tag inside jsx/tsx by specifying a specific project?
Something like: