javascriptnext.jspdf.jsreact-pdf-viewer

SyntaxError: Unexpected token '||='


I need to build nextjs project with PDFViewer using @react-pdf-viewer, but when collecting page there are some error SyntaxError: Unexpected token '||='.

The problem is occured from pdf.js in node_modules, I try to change ||= to || in pdf.js, and build no error.

But I need to deploy in hosting and need to download pdf.js from yarn install, some code that I change before will be restored.

How can I solve it?


Solution

  • You get this error with version below 15, so you need to upgrade to >=15.0.