Skip to content

Commit

Permalink
chore(gatsby-plugin-mdx): refactored to use createContentDigest (#8805)…
Browse files Browse the repository at this point in the history
… (#19885)

* gatsby-plugin-mdx refactored to use createContentDigest (#8805)

* createContentDigest usage simplified for gatsby-plugin-mdx (#8805)
  • Loading branch information
Stan-RED authored and pvdz committed Dec 17, 2019
1 parent ce70986 commit 730c7ca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/gatsby-plugin-mdx/utils/create-mdx-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const crypto = require(`crypto`)
const { createContentDigest } = require(`gatsby-core-utils`)

const mdx = require(`../utils/mdx`)
const extractExports = require(`../utils/extract-exports`)

Expand Down Expand Up @@ -39,10 +40,7 @@ module.exports = async ({ id, node, content }) => {
mdxNode.fileAbsolutePath = node.absolutePath
}

mdxNode.internal.contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(mdxNode))
.digest(`hex`)
mdxNode.internal.contentDigest = createContentDigest(mdxNode)

return mdxNode
}

0 comments on commit 730c7ca

Please sign in to comment.