I have a fragment in a file that contains a lot of other fragments.
file.gql
#import "./fragment.gql"
query Query {
...Fragment
}
fragment.gql
fragment Fragment {
...
}
...other fragments here
Doing this causes an error because of the unused fragments. Is it possible to import just that one fragment? Or do I seriously need to separate it into a different file to be able to use them?
You can imagine this becomes worse if I need to use X fragments of a file that contains X + 1 fragments.
1 Answer
I did not test this, but referring to the change log you should be able to import named fragments like this:
#import { myFragment1, myFragment2 } from './fragments.graphql'
(From GitHub https://github.com/apollographql/graphql-tag/pull/257)