chore(plugins): remove second require as it always fails

This commit is contained in:
Jonathan Rainville 2018-11-27 13:41:55 -05:00
parent f9384733f8
commit cb4f18c4c2
1 changed files with 7 additions and 18 deletions

View File

@ -52,27 +52,16 @@ Plugins.prototype.createPlugin = function(pluginName, pluginConfig) {
}; };
Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) { Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
var pluginPath = fs.embarkPath('dist/lib/modules/' + pluginName); const pluginPath = fs.embarkPath('dist/lib/modules/' + pluginName);
var plugin; let plugin;
try {
plugin = require(pluginPath); plugin = require(pluginPath);
if (plugin.default) { if (plugin.default) {
plugin = plugin.default; plugin = plugin.default;
} }
} catch(e) {
try{
pluginPath = fs.embarkPath('modules/' + pluginName);
plugin = require(pluginPath);
} catch(e2) {
this.logger.error(e.message);
this.logger.error(e.stack);
throw(e2);
}
}
var pluginWrapper = new Plugin({ const pluginWrapper = new Plugin({
name: pluginName, name: pluginName,
pluginModule: plugin, pluginModule: plugin,
pluginConfig: pluginConfig || {}, pluginConfig: pluginConfig || {},