Import and preprocess graphql documents using graphql-tag
with rollup
.
# src/schema.graphql
type Book {
title: String
author: Author
}
type Author {
name: String
books: [Book]
}
type Query {
getBooks: [Book]
getAuthors: [Author]
}
// src/index.js
import { ApolloServer } from 'apollo-server';
import typeDefs from './schema.graphql';
import * as resolvers from './resolvers';
const server = new ApolloServer({ typeDefs, resolvers });
import gql from 'rollup-plugin-graphql-tag';
export default {
input: 'src/index.js',
output: 'dist/index.js',
plugins: [gql()]
};