title: How to load external local JS file
body: <p>I have an external JS file that calls an external API but I'm unable to call the file in Vue when it's stored locally. How do you do this?</p>
  
  <p>The following works perfectly fine and connects to the API.</p>
  
  <pre><code>const cnp = document.createElement('script');
  cnp.setAttribute('src', https://example.com/cnp.js);
  document.head.appendChild(cnp);
  </code></pre>
  
  <p>This or any other variation of this doesn't work.</p>
  
  <pre><code>const cnp = document.createElement('script');
  cnp.setAttribute('src', '@/js/cnp.js');
  document.head.appendChild(cnp);
  </code></pre>
  
  <p>cnp.js contains</p>
  
  <pre><code>console.log('Hello');
  
  var wpwlOptions = {
      style: "plain",
      onReady: function() {
          console.log('wpwlReady.');
  
          var p = document.querySelector('form.wpwl-form-card');
          p.style.background = 'none';
      }
  }
  </code></pre>