v5 (latest)
Migration from Yoga V4

Migration from Yoga V4

Install the new NPM package

npm i graphql-yoga

1. Drop support for Node.js v16

Node.js v16 is no longer supported by the Node.js team. https://github.com/nodejs/Release/#end-of-life-releases

2. Plugin execution order is now more predictable

To allow more code reuse, plugins can automatically add other plugin on which they depend. For this, they use addPlugin method of the onPluginInit hook.

const plugin: Plugin = {
  onPluginInit({ addPlugin }) {

However, addPlugin method behavior was not the one expected by most users. It was adding the plugin at the end of the plugin list. This means that the added plugin hooks were executed last, after all other plugins.

In v4, the plugin is now added inplace in the plugin list. This means the added plugin hooks are executed immediately after the plugin that added them. This leads for a more predictable behaviour from an end user perspective, but can lead to unexpected results if a plugin relyed on the previous behaviour.

The best mitigation, if the plugin really need to execute some hooks last, is to split the plugin in 2 plugins and clearly state the dependency between them.