chore: refactor for better debugging

This commit is contained in:
Juan Picado @jotadeveloper 2019-02-28 23:00:48 +01:00
parent 1f71fb152c
commit 01d0f4a663
No known key found for this signature in database
GPG Key ID: 18AC54485952D158
1 changed files with 4 additions and 2 deletions

View File

@ -53,13 +53,15 @@ export default function loadPlugin<T>(config: Config, pluginConfigs: any = {}, p
return Object.keys(pluginConfigs).map((pluginId: string) => {
let plugin;
const localPlugin = Path.resolve(__dirname + '/../plugins', pluginId);
// try local plugins first
plugin = tryLoad(Path.resolve(__dirname + '/../plugins', pluginId));
plugin = tryLoad(localPlugin);
// try the external plugin directory
if (plugin === null && config.plugins) {
const pluginDir = config.plugins;
plugin = tryLoad(Path.resolve(pluginDir, pluginId));
const externalFilePlugin = Path.resolve(pluginDir, pluginId);
plugin = tryLoad(externalFilePlugin);
// npm package
if (plugin === null && pluginId.match(/^[^\.\/]/)) {