graphql-code-generator
graphql-code-generator copied to clipboard
Add options to minify document (query) when using documentMode String.
Is your feature request related to a problem? Please describe.
graphql has a utility function stripIgnoredCharacters that will effectively minify any string document. This could help with code size when strings representing queries are embedded in the source.
Describe the solution you'd like
I would like a config option that will run stripIgnoredCharacters right after print on documents.
Describe alternatives you've considered None
Additional context Thanks for this awesome suite of tools!
This would also be useful for the @graphql-codegen/schema-ast plugin. Some runtime environments such as Cloudflare Workers are limited to a code size of 1mb so every byte counts.
We are running into issues with this also. For now, since we are using Apollo client, I was able to use this method. https://www.apollographql.com/docs/react/networking/advanced-http-networking/#overriding-the-default-print-function
It would be nicer/faster though if we could have the generated already have the stripped version.