Skip to content

Commit 282b07c

Browse files
committed
Change upgrade guide for recent PRs
1 parent c18e9f6 commit 282b07c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

website/pages/upgrade-guides/v16-v17.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ import { Callout } from 'nextra/components'
1212

1313
# Breaking changes
1414

15+
## ESM only
16+
17+
GraphQL.js is now an ESM only library, for CJS builds use GraphQL v16 instead. This decision was made in light
18+
of `require(esm)` becoming a mainline feature in Node.js 20. This removes the dual package hazard from GraphQL.JS as
19+
we stop publishing two distinct versions for CJS and ESM.
20+
21+
## `setEnv`
22+
23+
We've removed the `process.env` check in favor of a more explicit `setEnv` function. By default we'll assume
24+
we are in `production` mode, if you need to run in `development` mode you can do so by calling `setEnv('development')`.
25+
26+
The main check that gets added is the `instanceOf` check, this is used to determine if a value is an instance of
27+
a given type but originates from a different version of the library.
28+
29+
```ts
30+
import { setEnv } from 'graphql';
31+
32+
setEnv('development');
33+
```
34+
1535
## Default values
1636

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

0 commit comments

Comments
 (0)