In Webpack 5, the [recommended way](https://webpack.js.org/guides/web-workers/) to create a web worker is

```ts
new Worker(new URL('./worker.js', import.meta.url));
```

Could we update\* the [`pdfjs-dist/webpack` entrypoint](https://github.com/mozilla/pdfjs-dist/blob/master/webpack.js) to use this syntax instead of the legacy `worker-loader`? One of the Webpack contributors told me that `worker-loader` uses "magic" and can cause issues.

\* To maintain compatibility with people still using Webpack 4, we should probably introduce a new entrypoint called `pdfjs-dist/webpack5` (or something like that) rather than changing the existing entrypoint.

Can attempt a PR if you would like.

Closely-related: https://github.com/mozilla/pdf.js/issues/15302


const pdfFile = fs.readFileSync(dir + "/build/pdf.js").toString();
  const pdfWorkerFile = fs
    .readFileSync(dir + "/build/pdf.worker.js")
    .toString();
  const pdfSandboxFile = fs
    .readFileSync(dir + "/build/pdf.sandbox.js")
    .toString();
  const pdfImageDecodersFile = fs
    .readFileSync(dir + "/image_decoders/pdf.image_decoders.js")
    .toString();
  const viewerFiles = {
    "pdf.js": pdfFile,
    "viewer.js": fs.readFileSync(dir + "/web/viewer.js").toString(),
  };
  console.log();
  console.log("### Minifying js files");
  const Terser = require("terser");
  const options = {
    compress: {
      
      sequences: false,
    },
    keep_classnames: true,
    keep_fnames: true,
  };
  fs.writeFileSync(
    dir + "/web/pdf.viewer.js",
    (await Terser.minify(viewerFiles, options)).code
  );
  fs.writeFileSync(