Registry / testing / gatsby-plugin-extract-schema

gatsby-plugin-extract-schema

JSON →
library0.2.2jsnpmunverified

A Gatsby plugin (v0.2.2) that extracts the generated GraphQL schema to a file (schema.graphql or schema.json) during the build process. It supports custom output destinations and lifecycle hooks (getSchema, adjustSchema, writeSchema) for transforming the schema before writing. Compatible with Gatsby v2 through v5. Ideal for integrating with eslint-plugin-graphql to validate queries against the actual schema. Last updated in 2021, currently in maintenance mode with no recent releases or bug fixes.

npm install gatsby-plugin-extract-schema
INSTALL
IMPORT
SIG · GATSBY-PLUGIN-EXTR
G
gatsby-plugin-extract-schema
testingjavascriptv0.2.2
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.

plugin registration
plugins: ['gatsby-plugin-extract-schema']
plugins: [require('gatsby-plugin-extract-schema')]
The plugin must be used as a string in gatsby-config.js, not required directly.
options dest
{ resolve: 'gatsby-plugin-extract-schema', options: { dest: `${__dirname}/path/to/schema.json` } }
{ resolve: 'gatsby-plugin-extract-schema', options: { dest: '/path/to/schema.json' } }
Use __dirname or path.resolve to ensure absolute path.

Add the plugin to gatsby-config.js to extract GraphQL schema to schema.graphql file in project root.

// gatsby-config.js module.exports = { plugins: ['gatsby-plugin-extract-schema'] };
Debug
Known issues
deprecatedPlugin is in maintenance mode; no updates since 2021. May not work with future Gatsby versions.
fix
Consider alternatives like gatsby-plugin-graphql-codegen or manually extracting schema.
affects: >=0.2.2
gotchaThe dest option must be an absolute path; using relative paths may fail.
fix
Use __dirname or path.resolve() to construct absolute paths.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'gatsby'
Missing peer dependency or incorrect Gatsby version.
fix
Ensure Gatsby >=2.0 is installed: npm install gatsby
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
gatsby-plugin-extract-schema — npm install gatsby-plugin-extract-schema · libregistry