Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(gatsby-plugin-mdx): prevent babel parse step at sourcing time #25437

Merged
merged 3 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 14 additions & 17 deletions packages/gatsby-plugin-mdx/gatsby/on-create-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { createContentDigest } = require(`gatsby-core-utils`)
const defaultOptions = require(`../utils/default-options`)
const createMDXNode = require(`../utils/create-mdx-node`)
const { MDX_SCOPES_LOCATION } = require(`../constants`)
const genMDX = require(`../utils/gen-mdx`)
const { findImports } = require(`../utils/gen-mdx`)

const contentDigest = val => createContentDigest(val)

Expand Down Expand Up @@ -56,22 +56,19 @@ module.exports = async (
createParentChildLink({ parent: node, child: mdxNode })

// write scope files into .cache for later consumption
const { scopeImports, scopeIdentifiers } = await genMDX(
{
node: mdxNode,
getNode,
getNodes,
reporter,
cache,
pathPrefix,
options,
loadNodeContent,
actions,
createNodeId,
...helpers,
},
{ forceDisableCache: true }
)
const { scopeImports, scopeIdentifiers } = await findImports({
node: mdxNode,
getNode,
getNodes,
reporter,
cache,
pathPrefix,
options,
loadNodeContent,
actions,
createNodeId,
...helpers,
})
await cacheScope({
cache,
scopeIdentifiers,
Expand Down