Skip to content

Commit 3bca15a

Browse files
committed
perf: ensure frontmatter is parsed as yaml only
1 parent f8d42b1 commit 3bca15a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/gatsby-plugin-mdx/src/frontmatter.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ export function parseFrontmatter(
1010
return cacheMap.get(cacheKey)
1111
}
1212

13-
const { content, data } = grayMatter(source)
13+
const { content, data } = grayMatter(source, {
14+
language: `yaml`,
15+
// Disable JS(ON) frontmatter parsing.
16+
// See: https://github.com/gatsbyjs/gatsby/pull/35830
17+
engines: {
18+
js: () => {
19+
return {}
20+
},
21+
javascript: () => {
22+
return {}
23+
},
24+
},
25+
})
1426
cacheMap.set(cacheKey, { content, data })
1527

1628
return { body: content, frontmatter: data }

0 commit comments

Comments
 (0)