On this page

Urql Introspection for Schema Awareness

Introspection plugin for urql. Generates a JSON file with the GraphQL schema. This file can be used to create a schema-aware cache.

Version
4.0.1
Weekly downloads
41k
License
MIT
Updated
Apr 19, 2026

Installation

          npm i -D @graphql-codegen/urql-introspection
        

Config API Reference

module

type: string

Compatible only with JSON extension, allow you to choose the export type, either module.exports or export default. Allowed values are: commonjs, es2015. Default value: “es2015”

useTypeImports

type: boolean

Will use import type {} rather than import {} when importing only types. This gives compatibility with TypeScript’s “importsNotUsedAsValues”: “error” option Default value: “false”

includeScalars

type: boolean

Includes scalar names (instead of an Any replacement) in the output when enabled. Default value: “false”

includeEnums

type: boolean

Includes enums (instead of an Any replacement) in the output when enabled. Default value: “false”

includeInputs

type: boolean

Includes all input objects (instead of an Any replacement) in the output when enabled. Default value: “false”

includeDirectives

type: boolean

Includes all directives in the output when enabled. Default value: “false”

How to use?

// generated by the plugin
import schema from './generated-introspection.json'

const cache = cacheExchange({ schema })