title: Critical dependency warning when using react-pdf
body: <p>I'm trying to display a pdf on a react application and i get the following warning: </p>
  
  <blockquote>
    <p>/node_modules/react-pdf/node_modules/pdfjs-dist/build/pdf.js
    Critical dependency: require function is used in a way in which dependencies cannot be statically extracted</p>
  </blockquote>
  
  <p>Vscode tells me this under the import function. </p>
  
  <blockquote>
    <p>Could not find a declaration file for module 'react-pdf'</p>
  </blockquote>
  
  <p>Already tried running <code>npm install</code>, <code>npm install react-pdf</code> and reinstalling the package</p>
  
  <pre><code>import React, { Component } from 'react';
  import { Document } from 'react-pdf';
  import sample from 'file location'
  export default class viewer extends Component {
      render() {
          return (
              &lt;div&gt;
                  &lt;Document
                      file={sample}
                      onLoadSuccess={this.onDocumentLoadSuccess}
                  &gt;
                  &lt;/Document&gt;
              &lt;/div&gt;
          );
      }
  }
  </code></pre>
  
  <p>Displays:</p>
  
  <blockquote>
    <p>"Failed to load PDF file" in the browser</p>
  </blockquote>