title: How to import crypto.js in either a vanilla javascript or node based javascript project
body: <p>I have (succesfully) done an</p>
  <pre><code> npm install --save crypto-js
  </code></pre>
  <p>in the current project. It shows up in <code>package.json</code>:</p>
  <pre><code>$grep crypto package.json
    &quot;crypto-js&quot;: &quot;^4.0.0&quot;,
  </code></pre>
  <p>Then in a local project javascript file I am trying to use it and have not figured it out.
  The following has been attempted:</p>
  <pre><code>var CryptoJS = require(&quot;crypto-js&quot;);
  </code></pre>
  <p>I have also tried to use the <code>import</code> approach after downloading the <code>aes.js</code> to the same local directory:</p>
  <pre><code> &lt;script type=&quot;text/javascript&quot; src=&quot;aes.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>This results in:</p>
  <blockquote>
  <p>Uncaught ReferenceError: require is not defined
  at my-project-worker.js:1</p>
  </blockquote>
  <pre><code>Uncaught ReferenceError: CryptoJS is not defined
      at encrypt (audio-clips-worker.js:168)
      at audio-clips-worker.js:235
      at Set.forEach (&lt;anonymous&gt;)
      at onmessage (audio-clips-worker.js:229)
  </code></pre>
  <p>Finally I tried leaving an absolute url:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>That gave the same &quot;CryptoJS is not defined&quot; error. What are <em>working</em> options here - and what steps are missing or need to be done differently?</p>