title: Vue: use a custom libary (pdf.js) in a component
body: <p>How can I use a vendor libary (specifically I want to use PDF.js) in a Vue component? (I only want to load it for this specific component as they are rather larger files)</p>
  
  <p>I'm building an editor that needs to load a pdf. So I placed the pdf.js and pdf.worker.js in /src/assets/vendor/pdfjs</p>
  
  <p>Then I load both in the template-editor-page.hbs that also loads the component:</p>
  
  <pre><code>&lt;div class="content"&gt;
    &lt;div class="row fill"&gt;
      &lt;div class="col-md-2 fill br pt30"&gt;
      &lt;/div&gt;
      &lt;div class="col-md-10 fill pt30 pl30 pr30"&gt;
        &lt;div id="template-editor" class="template-editor"&gt;  
          &lt;template-editor template-src="{{template.src}}"&gt;&lt;/template-editor&gt;    
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;script src="/assets/js/template-editor.bundle.js"&gt;&lt;/script&gt;
  &lt;script src="/assets/vendor/pdfjs/pdf.js"&gt;&lt;/script&gt;
  &lt;script src="/assets/vendor/pdfjs/pdf.worker.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>my template-editor.js (do I have to load it here?):</p>
  
  <pre><code>import Vue from 'vue';
  import templateEditor from './components/template-editor.vue';
  
  new Vue({
    el: '#template-editor',
    components: { templateEditor }
  });
  </code></pre>
  
  <p>Now I want to load the file in my template-editor.vue:</p>
  
  <pre><code>&lt;template&gt;
      &lt;!-- ... --&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  
    export default {
      props: ['templateSrc'],
      name: 'template-editor',
      data() {
        return {
          src: this.templateSrc
        };
      },
      methods: {
        render() {
          PDFJS.getDocument(this.$data.src).then(function(pdf) {
            console.log(pdf);
          }, err =&gt; console.log(err));
        }
      },
      created: function() {
        this.render();
      }
    };
  &lt;/script&gt;
  </code></pre>
  
  <p>But I get an error saying </p>
  
  <pre><code>ReferenceError: PDFJS is not defined
  </code></pre>
  
  <p>Everything else seems to be working out fine. What am I missing?</p>