-
Notifications
You must be signed in to change notification settings - Fork 1.5k
GraphiQL 5 blogpost annoncement #2015
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
dimaMachina
wants to merge
6
commits into
graphql:source
Choose a base branch
from
dimaMachina:graphiql-5-blog
base: source
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d424ca
wip
dimaMachina b310c41
images and polish
dimaMachina c880698
Update src/pages/blog/2025-06-10-graphiql-5/index.mdx
dimaMachina b690932
Update src/pages/blog/2025-06-10-graphiql-5/index.mdx
dimaMachina 35c8208
Update src/pages/blog/2025-06-10-graphiql-5/index.mdx
dimaMachina ff2cdff
Update src/pages/blog/2025-06-10-graphiql-5/index.mdx
dimaMachina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
--- | ||
title: The New GraphiQL 5 is Released; Press F1! | ||
tags: [announcements, grants] | ||
date: 2025-06-10 | ||
byline: Dimitri Postolov | ||
--- | ||
|
||
import { Callout } from "nextra/components" | ||
|
||
<figure className="mt-6"> | ||
<></> | ||
{/* prettier-ignore */} | ||
<figcaption className="mt-2 text-center">GraphiQL 5 with Monaco Editor Preview</figcaption> | ||
</figure> | ||
|
||
This post marks the completion of **8 weeks** of work on my GraphiQL grant, | ||
sponsored by the **GraphQL Foundation**. | ||
|
||
I'm thrilled to announce the release of the all-new **GraphiQL 5**, powered by | ||
the latest version of the [Monaco editor][monaco-editor]! 🎉 | ||
|
||
I also added support for comments in the **Variables** and **Headers** editors. | ||
This release is a major step forward. | ||
|
||
> [The original issue for integrating the Monaco editor](https://github.com/graphql/graphiql/issues/2326) | ||
> was opened over **3 years ago**.<br/> And the | ||
> [issue requesting comments support in the Variables editor](https://github.com/graphql/graphiql/issues/780) | ||
> was opened over **6 years ago**! | ||
|
||
As a primary maintainer of the GraphiQL IDE, I previously led the releases of | ||
GraphiQL 3 and [GraphiQL 4](/blog/2025-05-31-graphiql-4). This new version marks | ||
another exciting milestone in the evolution of the project. | ||
|
||
## What's New | ||
|
||
### Monaco Editor Migration | ||
|
||
GraphiQL 5 now uses [Monaco editor][monaco-editor] as default editor, the same | ||
editor used in [VSCode](https://code.visualstudio.com). | ||
|
||
Monaco editor runs heavy language features (like syntax analysis, linting, and | ||
IntelliSense) in | ||
[Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers), | ||
keeping the UI smooth and responsive. | ||
|
||
You can now delight your users with identical behavior to Visual Studio Code, | ||
meaning intelligent autocompletion, hover tooltips, go to definition, find | ||
references. I've also added | ||
[`monaco-graphql`](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql) | ||
integration in **Query** and **Variables** editor. | ||
|
||
<Callout type="info"> | ||
Clicking on a reference in the Query editor now works by holding `Cmd` on | ||
macOS or `Ctrl` on Windows/Linux. | ||
</Callout> | ||
|
||
### Support for Comments in Variables and Headers Editors | ||
|
||
Thanks to the migration to Monaco Editor, another long-awaited feature has been | ||
implemented. The **Variables** and **Headers** editors now support comments and | ||
use the **JSONC** language internally. | ||
|
||
In the **Variables** and **Headers** payloads, all comments are automatically | ||
stripped before the request is executed — the content in the editors **remains | ||
unchanged**. | ||
|
||
### UMD Builds Are Removed | ||
|
||
Previously in GraphiQL 4 UMD builds were marked as deprecated, in GraphiQL 5 | ||
they were removed completely. | ||
|
||
We suggest using ESM-based CDNs like [esm.sh][esm.sh] to import GraphiQL in your | ||
projects. | ||
|
||
I updated [GraphiQL CDN example][graphiql-cdn] to show how to use GraphiQL with | ||
[esm.sh][esm.sh] including how to import and setup workers. | ||
|
||
### Examples Update | ||
|
||
**GraphiQL with Parcel** and **GraphiQL with Create React App** examples were | ||
removed. | ||
|
||
In addition to updated [GraphiQL CDN example][graphiql-cdn], I've added 2 new | ||
examples | ||
[GraphiQL with Vite](https://github.com/graphql/graphiql/tree/main/examples/graphiql-vite) | ||
and | ||
[GraphiQL with Next.js](https://github.com/graphql/graphiql/tree/main/examples/graphiql-nextjs) | ||
and App Router. | ||
|
||
### Customizable Default Plugins | ||
|
||
GraphiQL 5 lets you take full control over the UI by allowing complete | ||
customization of its plugins. | ||
|
||
#### Removing All Default Plugins | ||
|
||
To remove all default plugins (currently **Doc Explorer** and **History**), set | ||
`referencePlugin={null}` and pass an empty array to the `plugins` prop: | ||
|
||
```jsx | ||
import { GraphiQL } from "graphiql" | ||
|
||
const myPlugins = [] | ||
|
||
function App() { | ||
return ( | ||
<GraphiQL | ||
referencePlugin={null} // Removes Doc Explorer plugin | ||
plugins={myPlugins} // Removes History plugin | ||
/> | ||
) | ||
} | ||
``` | ||
|
||
<Callout type="info"> | ||
If you're using a custom Doc Explorer, pass it to the `referencePlugin` prop — | ||
**not** the `plugins` array. It will be automatically included and always | ||
rendered first. | ||
</Callout> | ||
|
||
#### Adding Plugins While Keeping Defaults | ||
|
||
If you're adding custom plugins (e.g. the **Explorer** plugin) and want to keep | ||
the **History** plugin, you must explicitly include it in the `plugins` array: | ||
|
||
```jsx | ||
import { GraphiQL, HISTORY_PLUGIN } from "graphiql" | ||
import { explorerPlugin } from "@graphiql/plugin-explorer" | ||
|
||
const myPlugins = [HISTORY_PLUGIN, explorerPlugin()] | ||
|
||
function App() { | ||
return <GraphiQL plugins={myPlugins} /> | ||
} | ||
``` | ||
|
||
### Removed Props | ||
|
||
- `readOnly` | ||
- `keyMap` - to use Vim or Emacs keybindings in Monaco, you can use community | ||
plugins such as [Monaco Vim](https://github.com/brijeshb42/monaco-vim) or | ||
[Monaco Emacs](https://github.com/aioutecism/monaco-emacs) | ||
- `validationRules` - use custom GraphQL worker, see | ||
[Monaco GraphQL docs](https://github.com/graphql/graphiql/tree/main/packages/monaco-graphql#custom-webworker-for-passing-non-static-config-to-worker) | ||
|
||
<figure className="mt-6"> | ||
{/* prettier-ignore */} | ||
<></> | ||
{/* prettier-ignore */} | ||
<figcaption className="mt-2 text-center">Example of custom GraphQL validation rules</figcaption> | ||
</figure> | ||
|
||
### Additional Changes | ||
|
||
The shortcut to focus on the Doc Explorer search input is now `Cmd/Ctrl+Alt+K` | ||
instead of the previous `Cmd/Ctrl+K`. This was changed because monaco-editor has | ||
a built-in `Cmd/Ctrl+K` command. | ||
|
||
## How to Update | ||
|
||
Update `graphiql` using your favorite package manager: | ||
|
||
```sh npm2yarn | ||
npm i graphiql@latest | ||
``` | ||
|
||
### Setup Monaco Workers | ||
|
||
You need to set up Monaco workers in your project: | ||
|
||
- For **Vite** projects you must import: | ||
|
||
```js | ||
import "graphiql/setup-workers/vite" | ||
``` | ||
|
||
<Callout type="info"> | ||
See [Vite | ||
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-vite/src/App.jsx). | ||
</Callout> | ||
|
||
- For Webpack projects such as **Next.js** you must import: | ||
|
||
```js | ||
import "graphiql/setup-workers/webpack" | ||
``` | ||
|
||
<Callout type="info"> | ||
See [Next.js | ||
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-nextjs/src/app/page.tsx). | ||
</Callout> | ||
|
||
- For ESM-based CDN usages, you must use | ||
[`?worker` query](https://esm.sh/#web-worker) to load the module as a web | ||
worker: | ||
|
||
```js /?worker/ | ||
import createJSONWorker from "https://esm.sh/monaco-editor/esm/vs/language/json/json.worker.js?worker" | ||
import createGraphQLWorker from "https://esm.sh/monaco-graphql/esm/graphql.worker.js?worker" | ||
import createEditorWorker from "https://esm.sh/monaco-editor/esm/vs/editor/editor.worker.js?worker" | ||
|
||
globalThis.MonacoEnvironment = { | ||
getWorker(_workerId, label) { | ||
switch (label) { | ||
case "json": | ||
return createJSONWorker() | ||
case "graphql": | ||
return createGraphQLWorker() | ||
} | ||
return createEditorWorker() | ||
} | ||
} | ||
``` | ||
|
||
<Callout type="info"> | ||
See [CDN | ||
example](https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html). | ||
</Callout> | ||
|
||
## Stay Connected | ||
|
||
Follow me, **Dima Machina**, on [𝕏](https://x.com/dimaMachina_) and | ||
[GitHub](https://github.com/dimaMachina) to stay up to date with the latest | ||
updates! | ||
|
||
<Callout> | ||
I am available for consulting and open to new and exciting challenges. Please | ||
feel free to get in touch. | ||
</Callout> | ||
|
||
[monaco-editor]: https://github.com/microsoft/monaco-editor | ||
[graphiql-cdn]: | ||
https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html | ||
[esm.sh]: https://esm.sh |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.