function loadModule(moduleName) {
  let mod;

  try {
    mod = dynamicRequire(module, moduleName);
  } catch (e) {
    // no-empty
  }

  try {
    const { cwd } = dynamicRequire(module, 'process');
    mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) ;
  } catch (e) {
    // no-empty
  }

  return mod;
}
Helper for dynamically loading module that should work with linked dependencies.
The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))`
However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during
build time. `require.resolve` is also not available in any other way, so we cannot create,
a fake helper like we do with `dynamicRequire`.

We always prefer to use local package, thus the value is not returned early from each `try/catch` block.
That is to mimic the behavior of `require.resolve` exactly.

@param moduleName module name to require
@returns possibly required module