title: React pdf viewer - using worker from local server
body: <p>I am considering using a react pdf viewer package that I found <a href="https://react-pdf-viewer.dev/docs/basic-usage" rel="nofollow noreferrer">here</a>. In the docs it says that you should set the worker like this:</p>
  <p><em>It's up to you to use the pdf.worker.min.js file from popular services, such as
  <a href="https://unpkg.com/pdfjs-dist@2.5.207/build/pdf.worker.min.js" rel="nofollow noreferrer">https://unpkg.com/pdfjs-dist@2.5.207/build/pdf.worker.min.js</a>
  <a href="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.5.207/pdf.worker.min.js" rel="nofollow noreferrer">https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.5.207/pdf.worker.min.js</a>
  or download and store it on your server.</em></p>
  <p>And this is the example for using the worker from external service:</p>
  <pre><code>&lt;Worker workerUrl=&quot;https://unpkg.com/pdfjs-dist@2.5.207/build/pdf.worker.min.js&quot;&gt;
      &lt;!-- The viewer component will be put here --&gt;
      ...
  &lt;/Worker&gt;
  </code></pre>
  <p>But, if I am to use this package, I need the worker to be locally, I can't use external urls. There is no example of local usage of a worker. How can I set this up in a react app created with create react app?</p>