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.
A Strapi v3 plugin was enabled if it was manually installed or found in the plugins directory.
In Strapi v4:
- Installed plugins following the automatic plugins discovery pattern will automatically be enabled.
- While developing a local plugin, the plugin must explicitly be enabled in the ./config/plugins.jsfile of the Strapi application.
To enable a local plugin in v4 and define an optional configuration:
- If it does not already exist, create the - ./config/plugins.jsfile.
- In the - ./config/plugins.jsfile, export a function that:- returns an object
- and can take the {Β env }object as a parameter (see Environment configuration documentation).
 
- 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.
- Within the - "my-plugin"object, set the- enabledkey value to- true(boolean).
- (optional) Add a - resolvekey, whose value is the path of the plugin folder (as a string), and a- configkey (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
    },
  },
});
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" } }).