我正在尝试通过执行以下操作将图像导入 mdx 文件:![alt](image.jpg)
. 我的 mdx 文件和图像都存储在目录 src、posts、post-1 中。但是,图像不显示。我尝试了许多文件路径,但都没有运气。
我能够显示图像的唯一方法是使用 src 例如![alt](/static/47d93fd9bdeaaf54a7b60d14c66abe5d/48e00/icon.jpg)
以下是我的 gatsby.config 的一部分
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages/`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: "images",
path: `${__dirname}/src/images/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/posts/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `post-featured`,
path: `${__dirname}/src/post-featured/`,
},
},
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
{
resolve: "gatsby-plugin-mdx",
options: {
root: __dirname,
extensions: [".md", ".mdx"],
gatsbyRemarkPlugins: [
{
resolve: "gatsby-remark-images",
options: {
maxWidth: 800,
quality: 70,
},
},
],
},
},