title: 'Directory import is not supported resolving ES modules' with Node.js
body: <p>I'm using Node.js <strong>v14.13.0</strong>.</p>
  <p><strong>app.js</strong> file:</p>
  <pre><code>import database from './database';
  
  database();
  </code></pre>
  <p><strong>database/index.js</strong> file:</p>
  <pre><code>import mongoose from 'mongoose';
  
  export default connect = async () =&gt; {
      try {
          await mongoose.connect('...', { });
      } catch (error) {}
  };
  </code></pre>
  <p>In <strong>package.json</strong> I added <code>&quot;type&quot;: &quot;module&quot;</code>.</p>
  <p>After running the app I get the following error:</p>
  <blockquote>
  <p>Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import
  '/Users/xx/Desktop/Projects/node-starter/src/database' is not
  supported resolving ES modules imported from
  /Users/xx/Desktop/Projects/node-starter/src/app.js</p>
  </blockquote>