Serving static pdf with react webpack file loader
<p>I'm serving up some static files like images and fonts, without any problem. When I try to do the same with a PDF file, I get an Error.  </p>

<blockquote>
  <p>ERROR in ./src/views/default/components/Footer.js</p>
  
  <p>c:\Resurs\repos\Frontend\src\views\default\components\Footer.js
    5:17  error  Parse errors in imported module 'src/includes/ANVANDARAVTAL_MITTKONTOR.pdf'  import/default</p>
  
  <p>✖ 1 problem (1 error, 0 warnings)</p>
  
  <p>ERROR in ./src/views/default/components/Footer.js
  Module not found: Error: Cannot resolve module 'application-loader' in c:\Resurs\repos\Frontend\src\views\default\components
   @ ./src/views/default/components/Footer.js 21:32-84</p>
</blockquote>

<p>The webpack config works fine, with all the loaders for jsx, es6, css, static files... except for the loader config for PDF.</p>

<pre><code>{
    test: /\.pdf(\?v=[0-9]\.[0-9]\.[0-9])?$/,
    loader: 'file-loader?minetype=application/pdf&amp;name=[name].pdf'
}
</code></pre>

<p>My other loader config, that works, looks virtually the same for PDFs, AND WORKS... WHY (SOBBING)!? Ex: </p>

<pre><code>{
    test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
    loader: 'file-loader'
}
</code></pre>

<p>The import of files into react component looks like this:</p>

<pre><code>import bg from "src/design/images/loginBG.jpg"; //works fine
import pdf from "src/includes/ANVANDARAVTAL_MITTKONTOR.pdf"; //NOT WORKING!
</code></pre>

<p>I've tried so many configurations, googled the error, googled for loaders that could solve the problem. Nothing about serving static content from webpack/react, except the usual images, css, js. </p>

<p>I also tried serving a txt file just to see if it works. This also fails with the same error as the PDF. </p>

<p>Why does webpack try to parse the files when using the file loader? </p>