Rollup plugin that imports GraphQL files (.graphql, .gql) and compiles them into JavaScript modules using graphql-tag. Supports Apollo-style type definitions and fragment imports. Version 0.1.0, stable but no recent updates. Suitable for bundling GraphQL schemas with Rollup, alternative to raw loader plugins. Requires graphql as peer dependency. Not compatible with GraphQL v15+. Converts graphql files into transpiled query/mutation/subscription documents.
npm install rollup-plugin-graphql-tagVerified import paths — ran on the pinned version, not inferred.
Shows how to configure Rollup to import .graphql files using the plugin, and use the compiled schema in Apollo Server.
npm install graphql@14
Migrate to @rollup/plugin-graphql: npm install @rollup/plugin-graphql
Ensure the import path ends with .graphql or .gql, or use include/exclude options.
Use the imported document directly with Apollo Client or graphql-tag's print function.
npm install rollup-plugin-graphql-tag --save-dev
Add rollup-plugin-graphql-tag to plugins array in rollup.config.js
Use rollup.config.mjs or set type: module in package.json, or use dynamic import