Skip to content

Change upgrade guide for recent PRs #4387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 16.x.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions website/pages/upgrade-guides/v16-v17.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ import { Callout } from 'nextra/components'

# Breaking changes

## ESM only

GraphQL.js is now an ESM only library, for CJS builds use GraphQL v16 instead. This decision was made in light
of `require(esm)` becoming a mainline feature in Node.js 20. This removes the dual package hazard from GraphQL.JS as
we stop publishing two distinct versions for CJS and ESM.

## `setEnv`

We've removed the `process.env` check in favor of a more explicit `setEnv` function. By default we'll assume
we are in `production` mode, if you need to run in `development` mode you can do so by calling `setEnv('development')`.

The main check that gets added is the `instanceOf` check, this is used to determine if a value is an instance of
a given type but originates from a different version of the library.

```ts
import { setEnv } from 'graphql';

setEnv('development');
```

## Default values

GraphQL schemas allow default values for input fields and arguments. Historically, GraphQL.js did not rigorously validate or coerce these
Expand Down