Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #6725 #6769

Merged
merged 5 commits into from
Aug 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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: config.get(['plugins', plugin], {}) };
return acc;
}, {});
return _.merge(files, configs, userConfigs);
};

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