refactor(plugins): switched from require to await import() when loading plugins (#2558)
This commit is contained in:
@@ -5,7 +5,7 @@ const {extractErrors} = require('../utils');
|
||||
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||
const {loadPlugin, parseConfig} = require('./utils');
|
||||
|
||||
module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
module.exports = async (context, type, pluginOpt, pluginsPath) => {
|
||||
const {stdout, stderr, options, logger} = context;
|
||||
if (!pluginOpt) {
|
||||
return noop;
|
||||
@@ -13,7 +13,7 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||
|
||||
const [name, config] = parseConfig(pluginOpt);
|
||||
const pluginName = name.pluginName ? name.pluginName : isFunction(name) ? `[Function: ${name.name}]` : name;
|
||||
const plugin = loadPlugin(context, name, pluginsPath);
|
||||
const plugin = await loadPlugin(context, name, pluginsPath);
|
||||
|
||||
debug(`options for ${pluginName}/${type}: %O`, config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user