Skip to main content

v4 plugin migration: Enabling a plugin

This guide is part of the v4 plugin migration guide designed to help you migrate a plugin from Strapi v3.6.x to v4.0.x.

πŸ€“ v3/v4 comparison

A Strapi v3 plugin was enabled if it was manually installed or found in the plugins directory.

In Strapi v4:

To enable a local plugin in v4 and define an optional configuration:

  1. If it does not already exist, create the ./config/plugins.js file.

  2. In the ./config/plugins.js file, export a function that:

  3. Within the object exported by ./config/plugins.js, create a key with the name of the plugin (e.g. "my-plugin"). The value of this key is also an object.

  4. Within the "my-plugin" object, set the enabled key value to true (boolean).

  5. (optional) Add a resolve key, whose value is the path of the plugin folder (as a string), and a config key (as an object) that can include additional configuration for the plugin (see plugins configuration documentation).

Example: Enabling and configuring a "my-plugin" plugin

module.exports = ({ env }) => ({
"my-plugin": {
enabled: true,
resolve: "./path-to-my-plugin",
config: {
// additional configuration goes here
✏️ Plugins published on npm

If the plugin will be published on npm, the package.json file should include a strapi.kind key with a value set to "plugin" (i.e. { "strapi": { "kind": "plugin" } }).