title: Package.json with multiple entrypoints
body: <p>I have a library which was used as follows</p>
  <pre><code>import { Foo } from '@me/core';
  const foo = new Foo();
  </code></pre>
  <p>The <code>package.json</code> of that library looks like</p>
  <pre><code>&quot;name&quot;: &quot;@me/core&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;main&quot;: &quot;dist/index.js&quot;,
  &quot;types&quot;: &quot;dist/index.d.ts&quot;,
  &quot;license&quot;: &quot;MIT&quot;,
  ...
  </code></pre>
  <p>With <code>dist/index.js</code> its entrypoint. Now, however, I would provide an import for NodeJs projects only and one for web projects. Ideally I would have something like this for NodeJs</p>
  <pre><code>import { Foo } from '@me/core/nodejs';
  </code></pre>
  <p>and if you're working on a web-project you could do</p>
  <pre><code>import { Foo } from '@me/core/web';
  </code></pre>
  <p>My understanding is that both <code>@me/core/nodejs</code> and <code>@me/core/web</code> will be different NPM packages this way, which is not what I want. I want it to be in 1 npm package.</p>
  <p>I tried to changed the library's index.ts file, from</p>
  <pre><code>export * from './foo';
  </code></pre>
  <p>into</p>
  <pre><code>import * as nodejs from './nodejs';
  import * as web from './web';
  
  export { web, nodejs };
  </code></pre>
  <p>This actually works, but I have to use it now (in a NODEJS project) as follows</p>
  <pre><code>import { nodejs } from '@me/core';
  
  const foo = new nodejs.Foo();
  </code></pre>
  <p>Is there maybe a way to import this such that I don't need the <code>nodejs</code> everytime?</p>
  <p>As you can see I'm not so sure what I should do here so any help would be appreciated!</p>
  <p>UPDATE: Based on the suggestions by @Klaycon I see the following error:</p>
  <p><a href="https://i.stack.imgur.com/KrniS.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KrniS.jpg" alt="enter image description here" /></a></p>