我正在使用带有 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',
},
它将正确加载服务器模式。但是,如何配置它以验证或忽略start @client
导致错误的原因Unknown field "start" on object "Query"
和Unknown directive "@client"
错误?