code: function loadPluginsFromDir(dir, config) {
    try {
      fs
        .readdirSync(dir)
        .filter(resource => {
          if (path.basename(dir) != 'plugins') return RE_PLUGIN.test(resource);
          return RE_JS_FILE.test(resource) || fs.statSync(path.join(dir, resource)).isDirectory();
        })
        .forEach(resource => {
          registerPlugin(path.join(dir, resource), config);
        });
    } catch (err) {
      /* ignore */
    }
  }
docs: Load plugins in 'dir'
  @param {String} dir
  @param {Object} config