Ad
 
Learn More

Node 22.18 is the Important line in GraphQL Code Generator v8

GraphQL Code Generator 8.0.0 requires Node 22.18.0 or later and GraphQL 16 or 17, removes emitLegacyCommonJSImports, and starts plucking #graphql templates by default. Check your runtime and codegen.ts before you bump.

Written by Watch Changelog Team

•3 min read

Node 22.18 is the Important line in GraphQL Code Generator v8

The Guild shipped @graphql-codegen/cli 8.0.0 on November 7, with matching majors across the official plugins, and we flagged it as Important on GraphQL Code Generator. A major is allowed to break things, and this one does it where CI fails first: Node.js below 22.18.0 is no longer supported, and the graphql peer range is now ^16.0.0 || ^17.0.0. If your image or GitHub Action is still on Node 20, or the app is still on GraphQL 14 or 15, the install stops before codegen runs.

The line I would read twice is the runtime floor, not the 8.0.0 tag. The new @graphql-tools majors need Node 22.18.0 or newer, and every official package now says so in engines.node. Upgrade Node and graphql first, then bump the codegen packages together. Updating only the CLI while older plugins or @graphql-tools packages sit in the same repo is how you get duplicate installs and type errors that do not point at the real cause.

The same release has config and output breaks that are easy to miss if you treat v8 as just a Node bump:

  • emitLegacyCommonJSImports and the --emit-legacy-common-js-imports flag are gone. If you set emitLegacyCommonJSImports to false so relative imports got a .js extension, switch that to importExtension: '.js' (or --import-extension). Leaving the option unset still appends no extension. The old true value maps to leaving it out.
  • @graphql-tools/code-file-loader 9 now extracts #graphql-marked template literals by default, so codegen can pick up documents it used to ignore. Diff the generated output after you upgrade. To keep the previous behavior, set pluckConfig: { gqlHashComment: '' }.
  • generates values typed as a plugin array never worked at runtime. Arrays are now treated as ConfiguredOutput objects, and only the first element is used. Prefer a single object with a plugins list. An empty array, or an array whose first element is not a config object, throws Invalid Codegen Configuration.
  • Custom plugins that export validate must read outputFile, allPlugins, and pluginContext from the fourth argument object, not as extra positional arguments. There is no compatibility shim.
  • generate() is typed as Promise<FileOutput[] | void> instead of collapsing to any, so callers that index the result like an array need to narrow it first. In watch mode it resolves with no value.

The rest of the notes are for plugin authors more than for most app repos: the schema-ast commentDescriptions option is removed (it has done nothing since GraphQL 16), plugin-helpers dropped isOutputConfigArray, isConfiguredOutput, and normalizeImportExtension, and plugin-helpers now depends on @graphql-tools/apollo-engine-loader so published typings resolve. GraphQL 17 fragment arguments are available if you set experimentalFragmentArguments in the root config.

What I would do: confirm CI and local runtimes are on Node 22.18.0 or later, and that graphql is 16 or 17, before you touch codegen versions. Grep for emitLegacyCommonJSImports and replace any false value with importExtension: '.js'. Update the CLI and every official plugin you depend on in one pass, then run codegen and diff the output for newly plucked #graphql documents. If you maintain a custom plugin, fix the validate signature before you publish against v8. The rest of the day's flagged changes are on /sources/important.

Official notes: GraphQL Code Generator November 7, 2026 and the v8 migration guide.