graphql.macro
graphql.macro copied to clipboard
Support sharing fragments
It would be great if there was a way to either grab just specific operations from a specific file, or, alternatively, supply a path to a file containing fragments field as an argument to loader
. i.e.
export const storesQuery: DocumentNode<
Operations.StoresQuery,
Operations.StoresQueryVariables
> = loader('../queries/stores.graphql', {
fragments: '../fragments.graphql'
});
or something to that affect.
I'm guessing that this approach would be much simpler to implement than being able to have all of the queries and operations in a single file. I'm not an expert, but based on looking at what happens when you console.log
a file that is loaded in with multiple operations, you would have to somehow extract the relevant properties/fields from the AST and make them available after parsing the file.