Skip to content

Commit

Permalink
chore(docs): update documentation for node-fetch to use CommonJS (#35129
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Paul Scanlon committed Mar 14, 2022
1 parent 9690c7c commit cd0b80c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/docs/conceptual/data-fetching.md
Expand Up @@ -60,7 +60,8 @@ module.exports = {
Alternately, if you want to source data yourself you can use APIs Gatsby provides. Source plugins take advantage of the [`sourceNodes` API](/docs/reference/config-files/gatsby-node/#sourceNodes) and the [`createNode` action](/docs/reference/config-files/actions/#createNode) provided by Gatsby to make your data queryable during the build process. If you want to source data yourself you can add a section of code like this using the `createNode` API to add a node to your data layer manually:

```js:title=gatsby-node.js
const fetch = require(`node-fetch`)
const fetch = (...args) =>
import(`node-fetch`).then(({ default: fetch }) => fetch(...args))

exports.sourceNodes = async ({
actions: { createNode },
Expand Down

0 comments on commit cd0b80c

Please sign in to comment.