首页 > 解决方案 > 从 src 文件到源的 GraphQL 查询返回空边数组

问题描述

所以,我跟随这个盖茨比训练营。我在第 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 来尝试使用讲师使用的相同查询来获取数据,这就是它返回的内容:

操场输出

我还遵循了 gatsby 官方文档,了解如何实现这一目标并获得相同的结果。

关于有什么问题的任何想法?提前致谢

标签: graphqlgatsby

解决方案


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


推荐阅读