I recently upgraded my next.js project to version 12.0.7, along with Typescript (4.5.4) and pdfjs-dist (2.11.228), among other libraries. Locally, everything runs smoothly with the commands yarn dev
for development and yarn build
for building.
However, after committing and pushing to GitHub, I encountered a build error on the Vercel website:
Build error occurred
/vercel/path0/node_modules/pdfjs-dist/build/pdf.js:2358
return this._jsActionsPromise ||= this._transport.getPageJSActions(this._pageIndex);
^^^
SyntaxError: Unexpected token '||='
...
This SyntaxError is surprising as the syntax should be valid according to my understanding.
My tsconfig.json
configuration looks like this:
{
"compilerOptions": {
"target": "es5",
...
},
"include": [
...
],
"exclude": [
"node_modules"
]
}
If anyone has any insights or solutions, it would be greatly appreciated. Thank you!