title: How to require.resolve the package directory?
body: <p><code>require.resolve('babel-runtime')</code> returns an error because its <code>package.json</code> does not contain a "main" field. However, I'm not interested in the main/entry file of the package, I want to get the directory of the package itself.</p>
  
  <p>Usually that's located at <code>${__dirname}/node_modules/babel-runtime</code>, but it might not be if the <code>node_modules</code> tree is flattened. So how can I resolve the directory of a package the same way Node knows where to look when you write something like <code>require('babel-runtime/core-js/object/create')</code>?</p>