# 安装插件及其依赖库 npm install gatsby-source-filesystem gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react # 或 yarn add gatsby-source-filesystem gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react gatsby-source-filesystem : gatsby-plugin-mdx :转换 allFile 节点中格式为 .mdx、.md 的文件,生成新的 gatsby 数据层节点:allMdx、mdx。 name: `posts`, path: `${__dirname}/src/mdx/`, }, }, { resolve: `gatsby-plugin-mdx about.js import * as React from "react" import { graphql } from "gatsby" import { MDXRenderer } from "gatsby-plugin-mdx
Eating potato-based foods 2、解决方案 第一步:把 .mdx 文件转换为 MDX 数据节点,安装下面插件 npm install gatsby-source-filesystem gatsby-plugin-mdx : { name: `posts`, path: `${__dirname}/src/mdx/`, }, }, { resolve: `gatsby-plugin-mdx import * as React from 'react' import { graphql } from 'gatsby' import { MDXRenderer } from 'gatsby-plugin-mdx
"^4.4.0", "gatsby-plugin-manifest": "^2.9.1", "gatsby-plugin-material-ui": "^2.1.10", "gatsby-plugin-mdx