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?
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?
Share Improve this question edited Jun 7, 2022 at 2:41 Ethan 9928 gold badges18 silver badges30 bronze badges asked Jun 6, 2022 at 19:44 OrlandoOrlando 1161 silver badge7 bronze badges 6-
1
||=
is a recent addition to the language, what Node version are you using? – FZs Commented Jun 6, 2022 at 19:48 - im using 14.17.0 – Orlando Commented Jun 6, 2022 at 19:51
-
4
Update to >=15.0 in order to use
||=
– FZs Commented Jun 6, 2022 at 19:52 - wele to front-end, you may start with reading github./mozilla/pdf.js#using-pdfjs-in-a-web-application chapter – Kyr Commented Jun 6, 2022 at 21:36
-
@FZs it works, but i chose to downgrade
@react-pdf-viewer
– Orlando Commented Jun 7, 2022 at 17:18
1 Answer
Reset to default 7You get this error with version below 15, so you need to upgrade to >=15.0.