Named Operations Object
This plugin generates an object containing a list of all your GraphQL operations and fragments. This is useful if you are using Apollo-Client and wish to have type validation when you are using refetchQueries
.
All operations and fragments are being exported by their name (so unnamed operations are being ignored), in the following structure:
Installation
Using yarn
API Reference
identifierName
type: string
default: namedOperations
Allow you to customize the name of the exported identifier
Usage Examples
#
How to use?Include the plugin within your output (into an existing JS/TS file, or a new file), for example:
Now, you should be able to import namedOperations
from that file, and use the names within your code. For example, with Apollo Client, you can do: