fix: do not set path to plugin config defined as a Function or an Array
If a plugin hook was defined as a `Function` or an `Array` the `path` property would be set to the default value. Even if this bug had no actual negative impact, it should be fixed so the code would perform as intended.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const {isArray, isObject, omit, castArray, isUndefined} = require('lodash');
|
||||
const {isPlainObject, omit, castArray, isUndefined} = require('lodash');
|
||||
const AggregateError = require('aggregate-error');
|
||||
const getError = require('../get-error');
|
||||
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||
@@ -15,7 +15,7 @@ module.exports = (options, pluginsPath, logger) => {
|
||||
pluginConfs = def;
|
||||
} else {
|
||||
// If an object is passed and the path is missing, set the default one for single plugins
|
||||
if (isObject(options[pluginType]) && !options[pluginType].path && !isArray(def)) {
|
||||
if (isPlainObject(options[pluginType]) && !options[pluginType].path && castArray(def).length === 1) {
|
||||
options[pluginType].path = def;
|
||||
}
|
||||
if (config && !config.validator(options[pluginType])) {
|
||||
|
||||
Reference in New Issue
Block a user