-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
gatsby-config.mjs
67 lines (62 loc) · 1.64 KB
/
gatsby-config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import remarkGfm from "remark-gfm"
import rehypeSlug from "rehype-slug"
import { dirname } from "path"
import { fileURLToPath } from "url"
const __dirname = dirname(fileURLToPath(import.meta.url))
const config = {
siteMetadata: {
title: `Gatsby MDX e2e`,
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/posts`,
},
},
`gatsby-plugin-test-regression1`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
gatsbyRemarkPlugins: [
`gatsby-remark-images`,
`gatsby-remark-autolink-headers`,
],
mdxOptions: {
remarkPlugins: [
remarkRequireFilePathPlugin,
// This is an esm only packages, It should work out of the box
remarkGfm,
],
rehypePlugins: [
// This is an esm only packages, It should work out of the box
rehypeSlug,
],
},
},
},
!process.env.CI && `gatsby-plugin-webpack-bundle-analyser-v2`,
].filter(Boolean),
}
/**
* This is a test to ensure that `gatsby-plugin-mdx` correctly pass the `file` argument to the underlying remark plugins.
* See #26914 for more info.
*/
function remarkRequireFilePathPlugin() {
return function transformer(_, file) {
if (!file.dirname) {
throw new Error("No directory name for this markdown file!")
}
}
}
export default config