title: The difference between "require(x)" and "import x"
body: <p>I've just started working on a small node project that will interface with a MongoDB. However, I cannot seem to get the relevant node modules to import correctly, even though I have installed them correctly via <code>npm</code>.</p>
  
  <p>For example, the following code throws an error, telling me that "express has no default export":</p>
  
  <pre><code>import express from "express";
  </code></pre>
  
  <p>However, this code works:</p>
  
  <pre><code>const express = require("express");
  </code></pre>
  
  <p><strong>So my question is, what is the difference in how the import and variable/require methods function?</strong> I'd like to fix whatever is plaguing my imports on the project, as it seems likely to cause additional problems down the road.</p>