diff --git a/packages/strapi-plugin-graphql/services/Schema.js b/packages/strapi-plugin-graphql/services/Schema.js index d13249e3ed..dcb8a29949 100644 --- a/packages/strapi-plugin-graphql/services/Schema.js +++ b/packages/strapi-plugin-graphql/services/Schema.js @@ -266,8 +266,10 @@ module.exports = { resolvers, }); - // Write schema. - this.writeGenerateSchema(graphql.printSchema(schema)); + if (strapi.config.environment === 'development') { + // Write schema. + this.writeGenerateSchema(graphql.printSchema(schema)); + } // Remove custom scaler (like Upload); typeDefs = Types.removeCustomScalar(typeDefs, resolvers); diff --git a/packages/strapi/lib/core/plugins.js b/packages/strapi/lib/core/plugins.js index 51893e0f8b..d239e96b0a 100644 --- a/packages/strapi/lib/core/plugins.js +++ b/packages/strapi/lib/core/plugins.js @@ -88,6 +88,10 @@ module.exports = async function() { return; } + if (strapi.config.environment !== 'development') { + return; + } + // arrange system directories await Promise.all([ fs.remove(sourcePath),