plugins
plugins copied to clipboard
[@rollup/plugin-graphql] Processing GraphQL queries declared in template files
- Rollup Plugin Name: @rollup/plugin-graphql
- Rollup Plugin Version: 2.0.4
Feature Use Case
I'm using Vue 3 + Apollo GraphQL (composition API). I don’t use additional files (.gql/.graphql) to store GraphQL queries, but write them directly in files with the .vue extension, here’s a simple example:
// ...
import { gql } from "@apollo/client/core";
// ...
const {
mutate: createInvoiceMutationMutate,
} = useMutation(
gql`
mutation createInvoice($input: createInvoiceInput!) {
createInvoice(input: $input) {
clientMutationId
invoice {
id
}
}
}
`,
);
Unfortunately, at the moment there is no way to handle such a GraphQL query using @rollup/plugin-graphql
Feature Proposal
It would be great to be able to handle GraphQL queries that are declared in template files if they are wrapped in gql literal
UPD: https://github.com/apollographql/graphql-tag