fix: Use default plugin if the path property is missing from a single plugin configuration
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const {isArray} = require('lodash');
|
||||
const {isArray, isObject} = require('lodash');
|
||||
const DEFINITIONS = require('./definitions');
|
||||
const pipeline = require('./pipeline');
|
||||
const normalize = require('./normalize');
|
||||
@@ -8,6 +8,10 @@ module.exports = (options, logger) =>
|
||||
const {config, output, default: def} = DEFINITIONS[pluginType];
|
||||
let pluginConfs;
|
||||
if (options[pluginType]) {
|
||||
// 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)) {
|
||||
options[pluginType].path = def;
|
||||
}
|
||||
if (config && !config.validator(options[pluginType])) {
|
||||
throw new Error(config.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user