Loading Config


This function is the starting point for using GraphQL Config. It looks for a config file in predefined search places in the currently working directory.

A basic usage example (async):

import {loadConfig} from 'graphql-config';
async function main() {
const config = await loadConfig({...}); // an instance of GraphQLConfig

Synchronous version:

import {loadConfigSync} from 'graphql-config';
function main() {
const config = loadConfigSync({...}); // an instance of GraphQLConfig



type: string

An exact path of a config file.


type: string

A path of a directory where GraphQL Config should look for a file (uses process.cwd() by default).


type: string

A name of the config file. It's graphql by default. Using relay as a config name instructs GraphQL Config to look for all the variations of possible config file names where one of them is relay.config.js.


type: GraphQLExtensionDeclaration[]

An array of GraphQLExtensionDeclaration objects, place to register extensions.


type: boolean

GraphQL Config throws an error where there's no config file by default.


type: boolean

GraphQL Config by default throws an error if there's a config file but the file is empty.