【发布时间】:2019-11-16 13:58:26
【问题描述】:
我正在使用带有 React 的 Apollo 客户端、加载了 Webpack 的 graphql-tag 和 graphql-config 来维护客户端上的架构。
有一个文件./myclient/src/features/stats/graphql/getStart.graphql
query GetStart {
start @client
}
其中 start 和 @client 不使用 IDE graphql 插件进行验证,因为它们不包含在自动生成的架构中。
./myclient/.graphqlconfig 文件
{
"projects": {
"client": {
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"dev": "http://localhost:3000/graphql"
}
}
}
}
}
Webpack 配置为在客户端加载 graphql 架构
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
use: 'graphql-tag/loader',
},
它将正确加载服务器架构。但是,如何配置它以验证或忽略导致 Unknown field "start" on object "Query" 和 Unknown directive "@client" 错误的 start @client?
【问题讨论】:
标签: intellij-idea graphql apollo-client graphql-tag