This plugin is deprecated since one of this fork is now part of the official Rollup plugins, see @rollup/plugin-graphql
.
Convert GraphQL files to ES6 modules:
This fork is compatible with Rollup ^1.0 - thanks to @bennypowers (kamilkisiela#7).
And myself, I've just published the module on NPM to make the fork more easier to install on a project.
// import a GraphQL Document from a GraphQL file,
import schema from './schema.graphql';
// or import named Query/Mutation
import { FooQuery, FooMutation } from './schema.graphql';
npm install --save-dev @kocal/rollup-plugin-graphql
import { rollup } from 'rollup';
import graphql from '@kocal/rollup-plugin-graphql';
rollup({
entry: 'main.js',
plugins: [
graphql()
]
});
MIT