【问题标题】:Error: Invariant Violation: gatsby-source-graphql requires option `typeName` to be specified错误:不变违规:gatsby-source-graphql 需要指定选项“typeName”
【发布时间】:2019-08-16 18:01:18
【问题描述】:

我是 GatsbyJs - GraphQL 的新手,我一直在探索 gatsby(https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-source-graphql) 提供的示例,当我尝试使用本地 apollo-grapql 服务器时,它在前端返回数据,但是它抛出了上述错误并阻止构建过程,不确定我需要在这里传递的 typeName 到底是什么?任何帮助,这将不胜感激。

    `gatsby-source-graphql`,
    {
      resolve: "gatsby-source-graphql",
     options: {
      // This type will contain remote schema Query type
      typeName: "Query",
      // This is field under which it's accessible
      fieldName: "blah",
      // Url to query from
      url: "http://10.113.34.59:4000/graphql",
      // this is URL where served exposed its service in local
  },

【问题讨论】:

    标签: graphql gatsby


    【解决方案1】:
    `gatsby-source-graphql`, <==== this caused the issue
    {
      resolve: "gatsby-source-graphql",
     options: {
      // This type will contain remote schema Query type
      typeName: "Query",
      // This is field under which it's accessible
      fieldName: "blah",
      // Url to query from
      url: "http://10.113.34.59:4000/graphql",
      // this is URL where served exposed its service in local
    },
    

    下面的工作正常

    {
      resolve: "gatsby-source-graphql",
     options: {
      // This type will contain remote schema Query type
      typeName: "Query",
      // This is field under which it's accessible
      fieldName: "blah",
      // Url to query from
      url: "http://10.113.34.59:4000/graphql",
      // this is URL where served exposed its service in local
     },
    

    【讨论】:

      猜你喜欢
      • 2020-06-23
      • 2021-02-13
      • 2019-09-29
      • 2021-05-08
      • 1970-01-01
      • 2020-08-11
      • 2015-11-14
      • 2019-10-26
      • 2022-10-18
      相关资源
      最近更新 更多