小编bit*_*ebo的帖子

不能要求 gatsby-plugin-mdx 的评论和重新炒作插件

我试图遵循有关包含 gatsby-plugin-mdx 的 rehype 插件的文档。具体来说,我正在尝试使用该rehype-slug插件。我安装了用 npm 打包的包并将我的gatsby.config.js文件设置为

module.exports = {
  siteMetadata: {
    siteUrl: "https://www.yourdomain.tld",
    title: "test Website",
  },
  plugins: [
    {
      resolve: "gatsby-plugin-mdx",
      options:{
        rehypePlugins: [
          require("rehype-slug")
        ]
      }
    }
  ],
};
Run Code Online (Sandbox Code Playgroud)
但是运行时gatsby develop我遇到以下错误: Error: [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\User\Documents\test-site\node_modules\rehype-slug\index.js require() of ES modules is not supported.

我在尝试使用remark-mathrehype-katex插件时遇到类似的问题。我使用的是 Gatsby CLI 版本 3.13.0。即使使用全新的网站,问题仍然存在。任何有关此问题的帮助将不胜感激。

gatsby remarkjs gatsby-plugin-mdx

6
推荐指数
1
解决办法
3093
查看次数

标签 统计

gatsby ×1

gatsby-plugin-mdx ×1

remarkjs ×1