Skip to content

Module Options

autoImportPatterns?

optional autoImportPatterns: string[]

Defined in: options.ts:25

File glob patterns for the auto import feature.

If left empty, no documents are auto imported.

Default

json
["**/.{gql,graphql}", "!node_modules"]

Example

ts
// Load .graphql files from pages folder and from a node_modules dependency.
const autoImportPatterns = [
  './pages/**/*.graphql',
  'node_modules/my_library/dist/**/*.graphql',
]

clientCache?

optional clientCache: object

Defined in: options.ts:180

Client caching configuration.

enabled?

optional enabled: boolean

maxSize?

optional maxSize: number


codegenConfig?

optional codegenConfig: GeneratorOptions

Defined in: options.ts:139

Options for graphql-typescript-deluxe code generator.

See

GeneratorOptions


codegenSchemaConfig?

optional codegenSchemaConfig: object

Defined in: options.ts:144

Configuration for graphql-codegen when downloading the schema.

schemaAstConfig?

optional schemaAstConfig: SchemaASTConfig

Configure how the schema.graphql file should be generated.

See

SchemaASTConfig

urlSchemaOptions?

optional urlSchemaOptions: UrlSchemaOptions

Configure how the schema-ast introspection request should be made.

Usually this is where you can provide a custom authentication header:

typescript
const codegenSchemaConfig = {
  urlSchemaOptions: {
    headers: {
      authentication: 'foobar',
    },
  },
}
See

Types.UrlSchemaOptions


debug?

optional debug: boolean

Defined in: options.ts:82

Enable detailled debugging messages.

Default

ts
false

devtools?

optional devtools: boolean

Defined in: options.ts:175

Enable Nuxt DevTools integration.


documents?

optional documents: string[]

Defined in: options.ts:56

Additional raw documents to include.

Useful if for example you need to generate queries during build time.

Default

ts
;[]

Example

ts
const documents = [
  `
  query myQuery {
    articles {
      title
      id
    }
  }`,
  ...getGeneratedDocuments(),
]

downloadSchema?

optional downloadSchema: boolean

Defined in: options.ts:105

Download the GraphQL schema and store it on disk.

Usually you'll want to only enable this during dev mode.

Default

ts
true

enableFileUploads?

optional enableFileUploads: boolean

Defined in: options.ts:75

Enable support for uploading files via GraphQL.

When enabled, an additional useGraphqlUploadMutation composable is included, in addition to a new server endpoint that handles multi part file uploads for GraphQL mutations.


errorOverlay?

optional errorOverlay: boolean

Defined in: options.ts:87

Displays GraphQL response errors in an overlay in dev mode.


graphqlConfigFilePath?

optional graphqlConfigFilePath: string

Defined in: options.ts:34

The path where your graphql.config.ts is, relative to the location of nuxt.config.ts.

Used to generate the correct paths in the graphql.config.ts file generated by the module.

Default

ts
'./graphql.config.ts'

graphqlEndpoint

graphqlEndpoint: string

Defined in: options.ts:96

The URL of the GraphQL server.

For the runtime execution you can provide a method that determines the endpoint during runtime. See the server/graphqlMiddleware.serverOptions.ts documentation for more information.


includeComposables?

optional includeComposables: boolean

Defined in: options.ts:66

Wether the useGraphqlQuery, useGraphqlMutation and useGraphqlState composables should be included.

Default

ts
true

logOnlyErrors?

optional logOnlyErrors: boolean

Defined in: options.ts:132

Logs only errors.

When enabled only errors are logged to the console when generating the GraphQL operations. If false, all operations are logged, including valid ones.


schemaPath?

optional schemaPath: string

Defined in: options.ts:115

Path to the GraphQL schema file.

If downloadSchema is true, the downloaded schema is written to this specified path. If downloadSchema is false, this file must be present in order to generate types.

Default

ts
'./schema.graphql'

serverApiPrefix?

optional serverApiPrefix: string

Defined in: options.ts:124

The prefix for the server route.

Default

ts
'/api/graphql_middleware'

Released under the MIT License.