Skip to content

Refactor createPages implementation by replacing lodash with native iteration #515

@Divyansh9192

Description

@Divyansh9192

I noticed that lodash is currently included as a dependency but appears to be used only once inside gatsby-node.js.

Since native array methods like .forEach() provides equivalent functionality, we could:

  • Replace _.each with forEach

  • Remove the lodash dependency (if not used elsewhere)

  • Simplify the GraphQL query in createPages to only fetch required fields (id and fields.slug)

  • This would slightly reduce dependency surface and improve maintainability.

If this approach aligns with project direction, I’d be happy to submit a PR @krisstern .

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions