title: Change NPM entry point without an index.js
body: <p>I recently published a private module to NPM which has some common code we use across a few of our services.</p>
  
  <p>The code is written in ES6 and so we need to transpile it using babel before publishing to NPM. I've got a prepublish script which transpiles <code>src</code> in to <code>lib</code>.</p>
  
  <p>There's no <code>index.js</code> file in this module since it's just some common code.</p>
  
  <p>The problem I'm having is that when I install the module from NPM, using <code>require('@ourorg/ourmodule/somecode')</code> doesn't work (module can't be found). I instead have to use <code>require('@ourorg/ourmodule/lib/somecode')</code>.</p>
  
  <p>I've tried changing the <code>main</code> field in <code>package.json</code> to many variations of <code>lib</code>, but it doesn't seem to work unless I include an <code>index.js</code> file, in which case <code>require('@ourorg/ourmodule')</code> returns whatever is exported there. One workaround I can see would be to export all the common code in an <code>index.js</code> file, but this isn't maintainable at all.</p>