title: Importing RRule from rrule package in TypeScript. Getting SyntaxError: The requested module 'rrule' is expected to be of type CommonJS
body: <p><strong>Update</strong>: Tried to create a minimal repro here: <a href="https://github.com/aioobe/node-issue-repro" rel="nofollow noreferrer">https://github.com/aioobe/node-issue-repro</a>. It's very stripped down obviously, but it exhibits the same error message.</p>
  <pre><code>git clone git@github.com:aioobe/node-issue-repro.git
  cd node-issue-repro
  npm install
  npx tsc &amp;&amp; node build/index.js
  </code></pre>
  <hr />
  <p>In my TypeScript source code I have the following:</p>
  <pre><code>import { RRule } from 'rrule';
  
  // ...
  
  const oddDays = new RRule({
      freq: RRule.DAILY,
      bymonthday: [1, 3, 5]
  });
  </code></pre>
  <p>When I run this, I get the following output:</p>
  <pre><code>(node:31434) ExperimentalWarning: The Node.js specifier resolution in ESM is experimental.
  file:///home/aioobe/projects/test/server/database/storage.ts:10
  import { RRule } from 'rrule';
           ^^^^^
  SyntaxError: The requested module 'rrule' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
  For example:
  import pkg from 'rrule';
  const { RRule } = pkg;
      at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
      at ModuleJob.run (internal/modules/esm/module_job.js:137:5)
      at Loader.import (internal/modules/esm/loader.js:165:24)
      at Object.loadESM (internal/process/esm_loader.js:68:5)
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! daily-challenge@0.1.0 start-server: `cross-env NODE_ENV=development node --loader ts-node/esm --es-module-specifier-resolution=node server/server.ts`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the daily-challenge@0.1.0 start-server script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/aioobe/.npm/_logs/2020-09-13T15_53_32_162Z-debug.log
  npm run start-server exited with code 1
  --&gt; Sending SIGTERM to other processes..
  </code></pre>
  <p>In my <code>package.json</code> I have</p>
  <pre><code>{
      ...
      &quot;dependencies&quot;: {
          ...
          &quot;rrule&quot;: &quot;^2.6.6&quot;,
          ...
      },
      ...
      &quot;type&quot;: &quot;module&quot;
  }
  </code></pre>
  <p>(I need <code>&quot;type&quot;: &quot;module&quot;</code>, otherwise I'm running into <code>SyntaxError: Cannot use import statement outside a module</code>.)</p>
  <p>In my <code>tsconfig.json</code> I have</p>
  <pre><code>{
      &quot;compilerOptions&quot;: {
          ...
          &quot;allowJs&quot;: true,
          &quot;esModuleInterop&quot;: true,
          &quot;module&quot;: &quot;esnext&quot;,
          &quot;moduleResolution&quot;: &quot;node&quot;,
          ...
      },
      ...
  }
  </code></pre>
  <p>I've noted that in <a href="https://github.com/jakubroztocil/rrule" rel="nofollow noreferrer">rrule.js</a> the <a href="https://github.com/jakubroztocil/rrule/blob/master/package.json" rel="nofollow noreferrer"><code>package.json</code></a> does <em>not</em> have <code>&quot;type&quot;: &quot;module&quot;</code>, which according to <a href="https://nodejs.org/api/esm.html#esm_package_json_type_field" rel="nofollow noreferrer">this page</a> means that it should be interpreted as CommonJS.</p>
  <p>Honestly, I don't really know what this means for me. I've tried all kinds of syntax variations to include this package in my file (including the one suggested in the error message). I run into various errors, but the syntax posted above is the exact syntax used in the <a href="https://github.com/jakubroztocil/rrule" rel="nofollow noreferrer">example code</a> in the readme.</p>
  <p>I use node version 14.9.0, npm version 6.14.8, typescript version 3.7.2 and ts-node 8.10.2. I'm happy to upgrade/downgrade, but I'm running into the same issue with node 12 unfortunately.</p>
  <p>I use lots of other modules the above way without any problem.</p>