Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Possible to add sourcesNodes in the gatsby-node.js? #1285

@wcastand

Description

@wcastand

Bug Report

I'm trying to add data to the graphql source with a gatsby-config.js. but the console.log doesn't appear.

exports.sourceNodes = async ({
  actions,
  createNodeId,
  createContentDigest
}) => {
  console.log("pages");
  const { createNode } = actions;
  const data = puag.methodOptions;
  const nodeContent = JSON.stringify(data);

  const nodeMeta = {
    id: createNodeId(`puag-options`),
    parent: null,
    children: [],
    internal: {
      type: `PuagNode`,
      mediaType: `application/json`,
      content: nodeContent,
      contentDigest: createContentDigest(data)
    }
  };
  const node = Object.assign({}, data, nodeMeta);
  return await createNode(node);
};

i just took a look into .docz/gatsby-node.js and seems that we can only extend onCreateWebpackConfig and onCreateBabelConfig. Is there a reason for this?

how can i add more data to my website and is it possible to use StaticQuery after ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedIssue fixed and releasedquestionUsage question or clarification requestv2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions