Appearance
Module Options
autoImportPatterns?
optionalautoImportPatterns: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?
optionalclientCache:object
Defined in: options.ts:185
Client caching configuration.
enabled?
optionalenabled:boolean
Whether client caching should be enabled.
Note that if you set this to false during build, the cache will not be available at all. If you intend to enable/disable it using app config at runtime, it must be enabled at build!
Default
ts
falsemaxSize?
optionalmaxSize:number
The maximum number of cache entries.
Default
ts
100codegenConfig?
optionalcodegenConfig:GeneratorOptions
Defined in: options.ts:142
Options for graphql-typescript-deluxe code generator.
See
codegenSchemaConfig?
optionalcodegenSchemaConfig:object
Defined in: options.ts:147
Configuration for graphql-codegen when downloading the schema.
schemaAstConfig?
optionalschemaAstConfig:SchemaASTConfig
Configure how the schema.graphql file should be generated.
See
urlSchemaOptions?
optionalurlSchemaOptions: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
debug?
optionaldebug:boolean
Defined in: options.ts:82
Enable detailled debugging messages.
Default
ts
falsedevtools?
optionaldevtools:boolean
Defined in: options.ts:180
Enable Nuxt DevTools integration.
Default
ts
truedocuments?
optionaldocuments: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?
optionaldownloadSchema:boolean
Defined in: options.ts:108
Download the GraphQL schema and store it on disk.
Usually you'll want to only enable this during dev mode.
Default
ts
trueenableFileUploads?
optionalenableFileUploads: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?
optionalerrorOverlay:boolean
Defined in: options.ts:87
Displays GraphQL response errors in an overlay in dev mode.
experimental?
optionalexperimental:object
Defined in: options.ts:208
Experimental features.
improvedQueryParamEncoding?
optionalimprovedQueryParamEncoding:boolean
Enables improved encoding for GraphQL query param encoding.
If enabled, query variables that are non-strings such as numbers or booleans are encoded as strings, with a prefix in their name to indicate the type.
For example, given this object definining query variables:
{
name: 'John',
age: 35,
isUser: false
}This would be encoded as:
name=John&n:age=35&b:isUser=falseThis only works for flat primitive values. Nested objects or arrays are still encoded using the __variables fallback where all variables are JSON encoded.
graphqlConfigFilePath?
optionalgraphqlConfigFilePath: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?
optionalgraphqlEndpoint:string
Defined in: options.ts:99
The URL of the GraphQL server.
If not provided, the module will use the NUXT_GRAPHQL_MIDDLEWARE_GRAPHQL_ENDPOINT environment variable during dev mode.
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?
optionalincludeComposables:boolean
Defined in: options.ts:66
Wether the useGraphqlQuery, useGraphqlMutation and useGraphqlState composables should be included.
Default
ts
truelogOnlyErrors?
optionallogOnlyErrors:boolean
Defined in: options.ts:135
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?
optionalschemaPath:string
Defined in: options.ts:118
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?
optionalserverApiPrefix:string
Defined in: options.ts:127
The prefix for the server route.
Default
ts
'/api/graphql_middleware'