Why using a URL constructor with a file path to an esm file throws an error?
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
Why using a URL constructor with a file path to an esm file throws an error?
I get how to fix this error. Updating my nextjs config by setting
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
"pdfjs-dist/build/pdf.worker.min.mjs",
import.meta.url
).toString();I get how to fix this error. Updating my nextjs config by setting
esmExternals to loose fixes it. I am just curious why nextjs doesn't allow me to construct a url with an esm file path. Is nextjs misunderstanding this to be an import?