npm package.json main and project structure
<p>I have a issue with npm and the main field. I see the documentation and as of my understanding I point main to be a different entry point than ./index.js. I already tested the package where all dist files are inside the root folder. I ignore src and test during pack phase using .npmignore but I did not like the point that building and packing the project to verify the structure pul all my files into the package root folder. So i changed the output to be dist instead.</p>

<p>If i use npm pack and extract the file I get the following structure:</p>

<pre><code>/
dist
  -- index.js
  -- moduleA
    -- index.js
package.json
README.md
</code></pre>

<p>So for so good. But now I am forced to import it as follows:</p>

<pre><code>import {moduleA} from "myNpmModule/dist/moduleA";
</code></pre>

<p>But I dont want to have the dist folder in my import. So I set main in package.json</p>

<pre><code>"main": "dist/index.js"
</code></pre>

<p>But still it does not work and only works if I import with dist.
I use npm 3.10.7 and node 6.7.0.</p>

<p>Can anyone help?</p>

<p>Regards</p>