GraphQL Config is the standard configuration layer for GraphQL tools, editors, and IDEs. Current stable version is 5.1.6, with regular releases. It provides a unified way to define schema, documents, and GraphQL-related settings in a single file (YAML, JSON, JS, or TypeScript). It supports multiple loaders (cosmiconfig, TOML) and integrates with GraphQL Code Generator, GraphQL ESLint, and most GraphQL extensions. Unlike ad-hoc config handling, it offers a consistent API for library authors and end-users. Ships TypeScript types. Requires Node >= 16.
npm install graphql-configNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates loading a GraphQL config, accessing schema and documents, and retrieving a project schema asynchronously.
Update Node.js to >=16 and use import syntax. For CommonJS require, ensure you are using a compatible loader or transpiler.
Replace imports from 'graphql-config/helpers' with imports from 'graphql-config'.
Always validate config shape using TypeScript type GraphQLConfig or runtime checks.
Set legacy: true if using the deprecated `.graphqlconfig` format. Prefer `.graphqlrc` or `graphql.config.*`.
Install 'cosmiconfig-toml-loader' for TOML or ensure your config uses JSON or YAML without custom loaders.
Use named import from 'graphql-config': import { loadConfigSync } from 'graphql-config'Use named import: import { loadConfig } from 'graphql-config'; or const { loadConfig } = require('graphql-config');Ensure a .graphqlrc file (YAML/JSON/JS/TS) exists in the root directory or specify configPath.
Verify schema field in config: it should be a valid URL, file path, or introspection JSON.