【问题标题】:GraphQL query to source from src files returns empty edges array从 src 文件到源的 GraphQL 查询返回空边数组
【发布时间】:2021-01-24 21:12:53
【问题描述】:

所以,我正在关注 this Gatsby 训练营。我在第 10 节,讲师将展示如何从文件系统中获取内容。我安装了插件/依赖项以使用 gatsby (gatsby-source-filesystem) 访问文件系统,并将必要的配置添加到 gatsby-config.js 文件中。看起来是这样的:

/**
 * Configure your Gatsby site with this file.
 *
 * See: https://www.gatsbyjs.com/docs/gatsby-config/
 */

module.exports = {
  /* Your site config here */
  siteMetadata: {
    title: 'GSRdevelopment',
    author: 'Gustavo Rios'
  },
  plugins: [
    'gatsby-plugin-sass',
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        name: 'src',
        path: `${__dirname}/src/`
      }
    }
  ],
}

我终于使用 Playground graphql ide 尝试使用讲师使用的相同查询来获取数据,这就是它返回的内容:

我也关注了the gatsby official documentation on how to achieve this,得到了同样的结果。

有什么想法吗?提前致谢

【问题讨论】:

    标签: graphql gatsby


    【解决方案1】:

    好的,所以我决定继续观看视频,在我安装 gatsby-transformer-remark 插件/依赖项并设置它之后,游乐场 ide 这次返回了所需的输出。

    【讨论】:

      猜你喜欢
      • 2023-03-12
      • 2023-04-03
      • 2018-02-18
      • 1970-01-01
      • 2019-07-08
      • 2016-03-24
      • 2015-11-26
      • 2018-06-12
      • 1970-01-01
      相关资源
      最近更新 更多