Skip to content

Enums not tree shaking well #4253

Closed
Closed
@jasonkuhrt

Description

@jasonkuhrt

I have redefined the Kind and OperationTypeNode enums in Graffle because they do not seem to tree shake well. You can see the code and bundle visualization in this PR. With my approach already just those two enums are reduced by over 4kb in Graffle.

CleanShot 2024-10-24 at 16 14 07@2x

Obviously it would be nice if graphql was already fully tree shake optimized from the start. Is there an appetite to adjust how the enums are defined in graphql? I think my approach would be a breaking change at the type level because TypeScript enum types, even if using string constants at runtime, are not equivalent to them at the type level.

Feel free to close this issue if there's zero chance of change on the graphql package side of course. Convesely, happy to help out on this issue.

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