apollographql / apollo-feature-requests

πŸ§‘β€πŸš€ Apollo Client Feature Requests | (no πŸ› please).
Other
130 stars 7 forks source link

Whitespace minimization #182

Open atombender opened 5 years ago

atombender commented 5 years ago

When executing queries built with graphql-tag, the resulting AST seems to include all the whitespace, resulting in queries that are, in our case, about 30% larger when serialized to JSON than if all the unnecessary whitespace was stripped away.

This doesn't have a big impact, but it does add bandwidth use, and it can mean that a query that would otherwise fit in a GET request might have to be executed in a POST request instead.

I'd really like for Apollo to minimize queries automatically.

fbartho commented 5 years ago

I agree, it’s important to have a mode that serializes to exactly the same query as was written (for tooling purposes), but for over-the-wire calls, it feels like white space and comments should be strippable. This also plays in to Query registration / Query deduplication .