Skip to content

Commit a2ddf3f

Browse files
committed
config: configure mdx image imports
1 parent 287c242 commit a2ddf3f

2 files changed

Lines changed: 26 additions & 25 deletions

File tree

gatsby-config.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ const config: GatsbyConfig = {
1010
graphqlTypegen: true,
1111
plugins: [
1212
"gatsby-plugin-postcss",
13-
"gatsby-plugin-image",
14-
"gatsby-plugin-sharp",
15-
"gatsby-transformer-sharp",
16-
{
17-
resolve: "gatsby-source-filesystem",
18-
options: {
19-
name: "images",
20-
path: "./src/images/",
21-
},
22-
__key: "images",
23-
},
2413
{
2514
resolve: "gatsby-source-filesystem",
2615
options: {
@@ -29,20 +18,6 @@ const config: GatsbyConfig = {
2918
},
3019
__key: "pages",
3120
},
32-
{
33-
resolve: `gatsby-plugin-mdx`,
34-
options: {
35-
extensions: [`mdx`, `md`],
36-
gatsbyRemarkPlugins: [
37-
{
38-
resolve: `gatsby-remark-images`,
39-
options: {
40-
maxWidth: 590,
41-
},
42-
},
43-
],
44-
},
45-
},
4621
{
4722
resolve: `gatsby-source-filesystem`,
4823
options: {
@@ -60,6 +35,29 @@ const config: GatsbyConfig = {
6035
extensions: [],
6136
},
6237
},
38+
{
39+
resolve: `gatsby-plugin-mdx`,
40+
options: {
41+
extensions: [`mdx`, `md`],
42+
gatsbyRemarkPlugins: [
43+
{
44+
resolve: "gatsby-remark-mdx-relative-images",
45+
options: {
46+
staticFolderName: path.join(__dirname, "static"),
47+
},
48+
},
49+
{
50+
resolve: `gatsby-remark-images`,
51+
options: {
52+
maxWidth: 590,
53+
},
54+
},
55+
],
56+
},
57+
},
58+
"gatsby-plugin-image",
59+
"gatsby-plugin-sharp",
60+
"gatsby-transformer-sharp",
6361
],
6462
};
6563

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
"gatsby-plugin-sharp": "^5.14.0",
4040
"gatsby-remark-autolink-headers": "^6.14.0",
4141
"gatsby-remark-images": "^7.14.0",
42+
"gatsby-remark-mdx-relative-images": "^1.1.1",
43+
"gatsby-remark-relative-images": "^2.0.5",
44+
"gatsby-remark-relative-images-v2": "^0.1.5",
4245
"gatsby-source-filesystem": "^5.14.0",
4346
"gatsby-transformer-remark": "^6.14.0",
4447
"gatsby-transformer-sharp": "^5.14.0",

0 commit comments

Comments
 (0)