Gatsby:将组件导入到src文件夹之外的mdx文件中

时间:2019-06-06 09:36:56

标签: reactjs gatsby

我正在尝试在盖茨比进行投资,但是这个入门者有一个小问题:https://github.com/LekoArts/gatsby-starter-portfolio-emma

我尝试将一些组件导入/content/pages/about/index.mdx

我尝试使用此代码导入页脚(以进行测试),该代码返回:“未定义页脚”:

---
title: 'About'
slug: 'about'
cover: './mountains.jpg'
---

import Footer from '../../../src/components/Footer';

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands.

<Footer />

我找不到问题。有人可以指导我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

昨天我有同样的问题。 我是这样解决的:

  1. 停止服务器
  2. 使用以下命令清洁gatsby缓存
$ gatsby clean
  1. 重新启动开发服务器。