Skip to content

Commit

Permalink
fixes strapi#6725
Browse files Browse the repository at this point in the history
Signed-off-by: Tudor Ilisoi <tudorilisoi@yahoo.com>
  • Loading branch information
tudorilisoi committed Jun 22, 2020
1 parent 9ed11a6 commit cc2f69a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/strapi/lib/core/load-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const loadFiles = require('../load/load-files');
const loadConfig = require('../load/load-config-files');

module.exports = async ({ dir, config }) => {
const localPlugins = await loadLocalPlugins({ dir });
const localPlugins = await loadLocalPlugins({ dir, config });
const plugins = await loadPlugins({
installedPlugins: config.installedPlugins,
config,
Expand All @@ -28,7 +28,7 @@ module.exports = async ({ dir, config }) => {
return _.merge(plugins, localPlugins);
};

const loadLocalPlugins = async ({ dir }) => {
const loadLocalPlugins = async ({ dir, config }) => {
const pluginsDir = join(dir, 'plugins');

if (!existsSync(pluginsDir)) return {};
Expand All @@ -37,8 +37,11 @@ const loadLocalPlugins = async ({ dir }) => {
loadFiles(pluginsDir, '{*/!(config)/*.*(js|json),*/package.json}'),
loadConfig(pluginsDir, '*/config/**/*.+(js|json)'),
]);

return _.merge(files, configs);
const userConfigs = Object.keys(files).reduce((acc, plugin) => {
acc[plugin] = config.get(['plugins', plugin], {});
return acc;
}, {});
return _.merge(files, configs, userConfigs);
};

const loadPlugins = async ({ installedPlugins, config }) => {
Expand Down

0 comments on commit cc2f69a

Please sign in to comment.