resolverPlugin = (pluginName, eventsHandler) => {
  let name = pluginName.lastIndexOf('#') !== -1
    ? pluginName.substr(0, pluginName.lastIndexOf('#'))
    : pluginName;

  name = name.toLowerCase();

  if (name.indexOf(BUILT_IN_PREFIX) === 0) {
    if (name === `${BUILT_IN_PREFIX}jpg`) {
      eventsHandler.dispatch('warn', {
        msg:
          `The correct name for the built-in plugin "${name}" is`
          + ` "${BUILT_IN_PREFIX}jpeg"`
          + ', see https://github.com/leptojs/lepto#built-in-plugins \n'
          + 'Lepto will run with the correct plugin.',
        callOnceId: 'lepto.jpeg-typo'
      });
      name = `${BUILT_IN_PREFIX}jpeg`;
    }

    const plugin = name.substr(BUILT_IN_PREFIX.length, name.length);
    if (typeof nativePlugins[plugin] === 'function') {
      return nativePlugins[plugin];
    }

    eventsHandler.dispatch(
      'error',
      `Built-in plugin "${name}" not found, maybe you are looking for`
        + ` "lepto-${plugin}"`
        + ', see https://github.com/leptojs/lepto#built-in-plugins \n'
        + 'Lepto will run without.'
    );
    return null;
  }

  const pluginPath = name.indexOf('/') !== -1 ? name : `/node_modules/${name}`;
  try {
    const plugin = require(path.join(process.cwd(), pluginPath));
    if (typeof plugin === 'function') {
      return plugin;
    }
    eventsHandler.dispatch(
      'error',
      `Plugin "${name}" is not a function`
        + ', see https://github.com/leptojs/lepto#built-in-plugins \n'
        + 'Lepto will run without.'
    );
    return null;
  } catch (err) {
    eventsHandler.dispatch(
      'error',
      `Plugin "${name}" not found, try to install it with "npm i -D ${name}"`
        + ', see https://github.com/leptojs/lepto#built-in-plugins \n'
        + 'Lepto will run without.'
    );
    return null;
  }
}
Resolve a plugin func
@param {string} name
@param {EventsHandler} eventsHandler