v4 (latest)
Migrating from v3 to v4

Migrating from v3 to v4

With new major version comes breaking changes. This section will guide you through the process of migrating from v3 to v4.

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.