fix: use module name in logs for plugins loaded with plugins option
This commit is contained in:
@@ -10,9 +10,9 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
return noop;
|
||||
}
|
||||
|
||||
const [path, config] = parseConfig(pluginOpt);
|
||||
const pluginName = isFunction(path) ? `[Function: ${path.name}]` : path;
|
||||
const plugin = loadPlugin(context, path, pluginsPath);
|
||||
const [name, config] = parseConfig(pluginOpt);
|
||||
const pluginName = name.pluginName ? name.pluginName : isFunction(name) ? `[Function: ${name.name}]` : name;
|
||||
const plugin = loadPlugin(context, name, pluginsPath);
|
||||
|
||||
let func;
|
||||
if (isFunction(plugin)) {
|
||||
@@ -48,10 +48,10 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
Reflect.defineProperty(validator, 'pluginName', {value: pluginName, writable: false, enumerable: true});
|
||||
|
||||
if (!isFunction(pluginOpt)) {
|
||||
if (pluginsPath[path]) {
|
||||
logger.success(`Loaded plugin "${type}" from "${path}" in shareable config "${pluginsPath[path]}"`);
|
||||
if (pluginsPath[name]) {
|
||||
logger.success(`Loaded plugin "${type}" from "${pluginName}" in shareable config "${pluginsPath[name]}"`);
|
||||
} else {
|
||||
logger.success(`Loaded plugin "${type}" from "${path}"`);
|
||||
logger.success(`Loaded plugin "${type}" from "${pluginName}"`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user