Skip to content

Commit 3d424ca

Browse files
committed
wip
1 parent 0b2d07c commit 3d424ca

File tree

2 files changed

+214
-1
lines changed

2 files changed

+214
-1
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ pnpm-lock.yaml
44
!src/pages/blog/2024-04-11-announcing-new-graphql-website/index.mdx
55
!src/pages/blog/2024-08-15-graphql-local-initiative.mdx
66
!src/pages/community/foundation/community-grant.mdx
7-
!src/pages/blog/2025-06-01-graphiql-4/index.mdx
7+
!src/pages/blog/2025-05-31-graphiql-4/index.mdx
8+
!src/pages/blog/2025-06-10-graphiql-5/index.mdx
89
*.jpg
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
---
2+
title: The New GraphiQL 5 is Released
3+
tags: [announcements, grants]
4+
date: 2025-06-10
5+
byline: Dimitri Postolov
6+
---
7+
8+
import { Callout } from "nextra/components"
9+
10+
This post marks the completion of **8 weeks** of work on my GraphiQL grant,
11+
sponsored by the **GraphQL Foundation**.
12+
13+
I'm thrilled to announce the release of the all-new **GraphiQL 5**, powered by
14+
the latest version of the [Monaco editor][monaco-editor]! 🎉
15+
16+
I also added support for comments in the **Variables** and **Headers** editors.
17+
This release is a major step forward.
18+
19+
> [The original issue for integrating the Monaco editor](https://github.com/graphql/graphiql/issues/2326)
20+
> was opened over **3 years ago**.<br/> And the
21+
> [issue requesting comments support in the Variables editor](https://github.com/graphql/graphiql/issues/780)
22+
> was opened over **6 years ago**!
23+
24+
As a primary maintainer of the GraphiQL IDE, I previously led the releases of
25+
GraphiQL 3 and [GraphiQL 4](/blog/2025-05-31-graphiql-4). This new version marks
26+
another exciting milestone in the evolution of the project.
27+
28+
## What's New
29+
30+
### Monaco Editor Migration
31+
32+
GraphiQL 5 now uses [Monaco editor][monaco-editor] as default editor, the same
33+
editor used in [VSCode](https://code.visualstudio.com).
34+
35+
Monaco Editor runs heavy language features (like syntax analysis, linting, and
36+
IntelliSense) in
37+
[Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers),
38+
keeping the UI smooth and responsive.
39+
40+
You can now delight your users with identical behavior to Visual Studio Code,
41+
meaning intelligent autocompletion, hover tooltips, go to definition, find
42+
references. Of course, I've also added
43+
[`monaco-graphql`](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql)
44+
integration in **Query** and **Variables** editor.
45+
46+
<Callout type="info">
47+
Clicking on a reference in the Query editor now works by holding `Cmd` on
48+
macOS or `Ctrl` on Windows/Linux.
49+
</Callout>
50+
51+
### Support for Comments in Variables and Headers Editors
52+
53+
Thanks to the migration to Monaco Editor, another long-awaited feature has been
54+
implemented. The **Variables** and **Headers** editors now support comments and
55+
use the **JSONC** language internally.
56+
57+
In the **Variables** and **Headers** payloads all comments are automatically
58+
stripped before the request is executed — the content in the editors **remains
59+
unchanged**.
60+
61+
### UMD Builds Are Removed
62+
63+
Previously in GraphiQL 4 UMD builds were marked as deprecated, in GraphiQL 5
64+
they were removed completely.
65+
66+
We suggest using ESM-based CDNs like [esm.sh][esm.sh] to import GraphiQL in your
67+
projects.
68+
69+
I updated [GraphiQL CDN example][graphiql-cdn] to show how to use GraphiQL with
70+
[esm.sh][esm.sh] and although how to import and setup workers.
71+
72+
### Examples Update
73+
74+
**GraphiQL with Parcel** and **GraphiQL with Create React App** examples were
75+
removed.
76+
77+
#### New Examples
78+
79+
In addition to updated [GraphiQL CDN example][graphiql-cdn], I've added 2 new
80+
examples
81+
[GraphiQL with Vite](https://github.com/graphql/graphiql/tree/main/examples/graphiql-vite)
82+
and
83+
[GraphiQL with Next.js](https://github.com/graphql/graphiql/tree/main/examples/graphiql-nextjs)
84+
and App Router.
85+
86+
### Customizable Default Plugins
87+
88+
GraphiQL 5 lets you take full control over the UI by allowing complete
89+
customization of its plugins.
90+
91+
#### Removing All Default Plugins
92+
93+
To remove all default plugins (currently **Doc Explorer** and **History**), set
94+
`referencePlugin={null}` and pass an empty array to the `plugins` prop:
95+
96+
```jsx
97+
import { GraphiQL } from "graphiql"
98+
99+
const myPlugins = []
100+
101+
function App() {
102+
return (
103+
<GraphiQL
104+
referencePlugin={null} // Removes Doc Explorer plugin
105+
plugins={myPlugins} // Removes History plugin
106+
/>
107+
)
108+
}
109+
```
110+
111+
<Callout type="info">
112+
If you're using a custom Doc Explorer, pass it to the `referencePlugin` prop —
113+
**not** the `plugins` array. It will be automatically included and always
114+
rendered first.
115+
</Callout>
116+
117+
#### Adding Plugins While Keeping Defaults
118+
119+
If you're adding custom plugins (e.g. the **Explorer** plugin) and want to keep
120+
the **History** plugin, you must explicitly include it in the `plugins` array:
121+
122+
```jsx
123+
import { GraphiQL, HISTORY_PLUGIN } from "graphiql"
124+
import { explorerPlugin } from "@graphiql/plugin-explorer"
125+
126+
const myPlugins = [HISTORY_PLUGIN, explorerPlugin()]
127+
128+
function App() {
129+
return <GraphiQL plugins={myPlugins} />
130+
}
131+
```
132+
133+
### Removed Props
134+
135+
- `readOnly`
136+
- `keyMap` - to use Vim or Emacs keybindings in Monaco, you can use community
137+
plugins such as [Monaco Vim](https://github.com/brijeshb42/monaco-vim) or
138+
[Monaco Emacs](https://github.com/aioutecism/monaco-emacs)
139+
- `validationRules` - use custom GraphQL worker, see
140+
[Monaco GraphQL docs](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql#custom-webworker-for-passing-non-static-config-to-worker)
141+
142+
## How to Update
143+
144+
Update `graphiql` using your favorite package manager:
145+
146+
```sh npm2yarn
147+
npm i graphiql@latest
148+
```
149+
150+
### Setup Monaco Workers
151+
152+
You need to set up Monaco workers in your project:
153+
154+
- For **Vite** projects you must import:
155+
156+
```js
157+
import "graphiql/setup-workers/vite"
158+
```
159+
160+
<Callout type="info">
161+
See [Vite
162+
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-vite/src/App.jsx).
163+
</Callout>
164+
165+
- For Webpack projects such as **Next.js** you must import:
166+
167+
```js
168+
import "graphiql/setup-workers/webpack"
169+
```
170+
171+
<Callout type="info">
172+
See [Next.js
173+
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-nextjs/src/app/page.tsx).
174+
</Callout>
175+
176+
- For ESM-based CDN usages, you must use
177+
[`?worker` query](https://esm.sh/#web-worker) to load the module as a web
178+
worker:
179+
180+
```js /?worker/
181+
import createJSONWorker from "https://esm.sh/monaco-editor/esm/vs/language/json/json.worker.js?worker"
182+
import createGraphQLWorker from "https://esm.sh/monaco-graphql/esm/graphql.worker.js?worker"
183+
import createEditorWorker from "https://esm.sh/monaco-editor/esm/vs/editor/editor.worker.js?worker"
184+
185+
globalThis.MonacoEnvironment = {
186+
getWorker(_workerId, label) {
187+
switch (label) {
188+
case "json":
189+
return createJSONWorker()
190+
case "graphql":
191+
return createGraphQLWorker()
192+
}
193+
return createEditorWorker()
194+
}
195+
}
196+
```
197+
198+
<Callout type="info">
199+
See [CDN
200+
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html).
201+
</Callout>
202+
203+
## Stay Connected
204+
205+
Follow me, **Dima Machina**, on [𝕏](https://x.com/dimaMachina_) and
206+
[GitHub](https://github.com/dimaMachina) to stay up to date with the latest
207+
updates!
208+
209+
[monaco-editor]: https://github.com/microsoft/monaco-editor
210+
[graphiql-cdn]:
211+
https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
212+
[esm.sh]: https://esm.sh

0 commit comments

Comments
 (0)