跳到主要内容

Plugins configuration

Plugin configurations are stored in ./config/plugins.js|ts (see project structure). Each plugin can be configured with the following available parameters:

ParameterDescriptionType
enabledEnable (true) or disable (false) an installed pluginBoolean
config

Optional
Used to override default plugin configuration (defined in strapi-server.js)Object
resolve
Optional, only required for local plugins
Path to the plugin's folderString
./config/plugins.js

module.exports = ({ env }) => ({
// enable a plugin that doesn't require any configuration
i18n: true,

// enable a custom plugin
myplugin: {
// my-plugin is going to be the internal name used for this plugin
enabled: true,
resolve: './src/plugins/my-local-plugin',
config: {
// user plugin config goes here
},
},

// disable a plugin
myotherplugin: {
enabled: false, // plugin installed but disabled
},
});
💡 Tip

If no specific configuration is required, a plugin can also be declared with the shorthand syntax 'plugin-name': true.

GraphQL configuration

The GraphQL plugin has the following specific configuration options that should be declared in a graphql.config object. All parameters are optional:

ParameterDescriptionTypeDefault
apolloServerAdditional configuration for ApolloServer.Object{}
artifactsObject containing filepaths, defining where to store generated artifacts. Can include the following properties:
  • schema: path to the generated GraphQL schema file
  • typegen: path to generated TypeScript types
Only works if generateArtifacts is set to true.
Object
  • schema: false
  • typegen: false
defaultLimitDefault value for the pagination[limit] parameter used in API callsInteger100
depthLimitLimits the complexity of GraphQL queries.Integer10
endpointThe URL path on which the plugin is exposedString/graphql
generateArtifactsWhether Strapi should automatically generate and output a GraphQL schema file and corresponding TypeScript definitions.

The file system location can be configured through artifacts.
Booleanfalse
maxLimitMaximum value for the pagination[limit] parameter used in API callsInteger-1
playgroundAlwaysWhether the playground should be publicly exposed.

Enabled by default in if NODE_ENV is set to development.
Booleanfalse
shadowCRUDWhether type definitions for queries, mutations and resolvers based on models should be created automatically (see Shadow CRUD documentation).Booleantrue
./config/plugins.js

module.exports = () => ({
graphql: {
enabled: true,
config: {
playgroundAlways: false,
defaultLimit: 10,
maxLimit: 20,
apolloServer: {
tracing: true,
},
}
}
})