Error during production build with pdfjs-dist. static/media/pdf.worker.min.05101219.mjs from Terser x 'import', and 'export' cannot be used outside of module code #61549
Replies: 6 comments 6 replies
-
yep I am also running into this. nrwl/nx#21611 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
For me downgrading to react-pdf 8.0.2 solved the issue. |
Beta Was this translation helpful? Give feedback.
-
Was pulling my hair out until I found the following steps. Finally got it working.
|
Beta Was this translation helpful? Give feedback.
-
For me I don't want to downgrade the pdfjs-dist version as the pdfjs-dist version has high vulnerability in lower versions any other alternative ? |
Beta Was this translation helpful? Give feedback.
-
Try |
Beta Was this translation helpful? Give feedback.
-
Summary
Getting these when trying to deploy a Next.js 14 app to Vercel on Node.js 20:
It appears to be coming from pdfjs-dist which I have added through
pnpm add pdfjs-dist
. Everything works fine locally, I have been able to develop a webpage using pdfjs-dist, but not sure what could be the culprit here. Any ideas?Additional information
Example
I didn't add anything fancy to my next.config.ts, it is using what I had before:
Beta Was this translation helpful? Give feedback.
All reactions