title: Import a local pdf file in vue project
body: <p>I am trying to import a local pdf file in my vue project (bootstrapped using vue-cli@latest, using default config) but vue tries to parse it and gives this error:</p>
  
  <pre><code>./src/assets/myFile.pdf 1:0
  Module parse failed: Unexpected token (1:0)
  You may need an appropriate loader to handle this file type.
  (Source code omitted for this binary file)
  </code></pre>
  
  <p>I just want to make the file available for download from a button click so I don't need to parse it but I need it to go through webpack so that the filename will get hashes, hence I want to avoid putting it in public folder and use <code>env.BASE_URL</code>.<br>
  Here the my <code>.vue</code> file for the component.</p>
  
  <pre><code>&lt;template&gt;
    &lt;div class="root"&gt;
      &lt;a
        v-bind:href="MyPdf"
        download='Something.pdf'
      &gt;
        Download as pdf
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
    import MyPdf from '../assets/my.pdf';
  
    export default {
      name: "PdfDownload",
      data: function () {
        return { MyPdf }
      }
    }
  &lt;/script&gt;
  
  &lt;style scoped&gt;
    ...
  &lt;/style&gt;
  </code></pre>
  
  <p>I found similar questions on SO, but none of the answers solve the problem. I only solution I found was on vue docs to use <code>public</code> folder but I don't want that because I want hashes in filename. I am new to vue, I come from React, and in React you can simply import a pdf, word etc. file in js and use it in <code>href</code> of <code>a</code> and users can view/download it.</p>