Skip to content

Reducing Bundle Size #166

Open
Open
@jvcmanke

Description

@jvcmanke

I was testing out the library with a small schema and realized that around 80% of the generated file is the configuration object that holds info on the schema for building the query.

My main issue is that this object really cannot be minimized by build tools, and can grow a lot with bigger schemas.

With that said, I am not familiar with the codebase so I don't know what is possible, but I'll throw in some ideas and see what sticks:

  • Make this configuration object tree-shakable (by query/mutation for example)
    • This would allow to import only the parts of the schema that you are using to send to the browser
  • Remove false properties (ie. { array: false }) this could reduce the object size around 30%
  • Create a macro/plugin (for babel or webpack for example) to replace the queries at build time, that way the benefits of the type-safe, and very intuitive client remain and in production there is no need to even ship the query builder code.

Either way, keep doing what you're doing!
Thanks for the great tool!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions