Skip to content

GraphQL: follow #import edges in module graph (dead-code / unused files). #250

@lsbyerley

Description

@lsbyerley

Problem

Fallow’s module graph does not treat GraphQL #import lines as edges between documents. Fragment and schema files that are only referenced via #import (and not via JS/TS import) are reported as unused files or otherwise disconnected from the graph. Please consider parsing #import (at least relative string paths) so the static graph matches common bundler behavior.

Example: MyStory.graphql

#import "./content.graphql"
#import "./leaf.graphql"

fragment MyStory on Story {
  field {
    ...content
    ...leaf
  }
}

Here ./content.graphql and ./leaf.graphql are required at build time but may never appear in a JS/TS import if only other .graphql files pull them in. These files are then flagged as unused

Proposed solution

No response

Alternatives considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions