title: Not sure how to Import crypto-js to a test page served from express.js
body: <p>I'm trying to import <a href="https://github.com/brix/crypto-js" rel="nofollow noreferrer">crypto-js</a> so I can use any of the crypto-js functions. I can't successfully import it when I serve a static test webpage from Express.js.</p>
  <p>I get the error <strong>Uncaught SyntaxError: import not found: sha256</strong> in the browser console.</p>
  <p>To reproduce with code snippets below:</p>
  <ol>
  <li>create directory</li>
  <li><code>npm install express</code></li>
  <li><code>npm install crypto-js</code></li>
  <li>put the app.js file in the root directory of the project</li>
  <li>create a public folder in the root directory of the project</li>
  <li>put <code>index.html</code> and <code>index.js</code> files both in the <code>/public</code> directory</li>
  <li>open a terminal and go to the project and type <code>node app.js</code> to run it</li>
  <li>then go to your browser and go to <code>127.0.0.1:3000/static/</code></li>
  <li>open the browser console to see the error.</li>
  </ol>
  <p>I have tried changing the path of the import statement to <code>import sha256 from 'crypto-js/sha256';</code> but that just leads to another error.</p>
  <p>app.js</p>
  <pre><code>const express = require('express');
  const app = express();
  const port = 3000;
  const path = require('path');
  app.use('/static' , express.static(path.join(__dirname,'/node_modules')));
  app.use('/static', express.static(path.join(__dirname, '/public')));
  app.listen(port, () =&gt; {
    console.log(`Example app listening on port ${port}`);
  });
  </code></pre>
  <p>index.html</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Test Page! &lt;/title&gt;
          &lt;script  src=&quot;index.js&quot; type=&quot;module&quot; &gt;&lt;/script&gt;
          
      &lt;/head&gt;
      &lt;body&gt;
              &lt;h1&gt;TEST PAGE!&lt;/h1&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>index.js</p>
  <pre><code>import {sha256} from '/static/crypto-js/sha256.js';
  
  </code></pre>