Keep the worker version in sync with pdfjs-dist version

As mentioned in the Setting up the worker section, the worker version has to be the same as the version of the `pdfjs-dist` package. Otherwise, you you will see the error message like this:
The API version "2.6.347" does not match the Worker version "2.1.266"
The worker version is determined in the `Worker` component usage:
<Worker workerUrl="">...</Worker>
Whereas the version of `pdfjs-dist` is found in the `package.json` file when you install the package:
"dependencies": {
"pdfjs-dist": "^2.6.347",
It isn't convenient and error prone when you upgrade `pdfjs-dist` but forget to set the same version for the worker.
You can keep both versions in sync to each other by replacing the worker version with the `pdfjs-dist` version found in the `package.json`:
// The path to `package.json` can be changed depending the path of current file
import packageJson from '../package.json';
const pdfjsVersion = packageJson.dependencies['pdfjs-dist'];
<Worker workerUrl={`${pdfjsVersion}/build/pdf.worker.min.js`}>...</Worker>;

See also