Importing pdf.mjs into app.js

Hi all,

I’m trying to use pdf.js and importing it like so:

import PDFJS from "../vendor/pdf.mjs"

so I can use it in a Hook to render the 1st page of a PDF, but I’m getting:

✘ [ERROR] Top-level await is not available in the configured target environment ("es2018")

    vendor/pdf.mjs:16837:53:
      16837 │ ...ck_exports__ = globalThis.pdfjsLib = await __webpack_exports__;
            ╵                                         ~~~~~

I’ve tried incrementing the es version in config.exs to no avail.

Anyone else using .mjs files? They are from https://github.com/mozilla/pdf.js/releases/download/v4.0.189/pdfjs-4.0.189-dist.zip

Thanks.