Registry / devops / rollup-plugin-graphql

rollup-plugin-graphql

JSON →
library0.1.0jsnpmunverified

Converts GraphQL (.graphql) files into ES6 modules for use with Rollup bundler. Version 0.1.0 has infrequent releases. Minimal plugin with no additional features beyond file-to-module conversion, contrasting with more feature-rich alternatives like graphql-tag/loader. Only supports GraphQL documents, not fragments or operations separately. Requires peer dependency graphql ^0.9.0 or ^0.10.0. Limited to Rollup; not compatible with other bundlers.

npm install rollup-plugin-graphql
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-GRAP
R
rollup-plugin-graphql
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

graphql (default export)
✓ import graphql from 'rollup-plugin-graphql'
✗ import { graphql } from 'rollup-plugin-graphql'
The plugin is a default export; named import is incorrect.
graphql function
✓ const graphql = require('rollup-plugin-graphql')
CommonJS usage works but requires a default import via require.
graphql configuration
✓ graphql({ include: '**/*.graphql', exclude: 'node_modules/**' })
Accepts Rollup plugin options like include/exclude; no GraphQL-specific options.

Shows using rollup-plugin-graphql to import a GraphQL schema file in a Rollup build.

import { rollup } from 'rollup'; import graphql from 'rollup-plugin-graphql'; rollup({ input: 'src/main.js', plugins: [ graphql() ], output: { file: 'dist/bundle.js', format: 'esm' } });
Debug
Known issues
breakingPeer dependency graphql version range ^0.9.0 || ^0.10.0; may break with newer versions.
fix
Pin graphql to ^0.10.0 or use a different plugin.
affects: >=0.1.0
gotchaOnly supports converting single GraphQL documents; cannot handle fragments or operations separately.
fix
Use graphql-tag/loader or other tools for advanced GraphQL usage.
affects: >=0.1.0
gotchaNo support for .gql extension; only .graphql files are processed.
fix
Rename files to .graphql or adjust plugin configuration.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-graphql'
Local module not installed; missing from node_modules.
fix
Run npm install --save-dev rollup-plugin-graphql
Error: Could not resolve './schema.graphql'
GraphQL file path incorrect or missing extension.
fix
Ensure the file exists and path is correct; consider using absolute paths.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
graphqlrequiredUsed to parse and validate GraphQL documents; peer dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-graphql — npm install rollup-plugin-graphql · libregistry