构建过程中的 pdfjs-dist 包问题

Ali*_*tir 5 pdf.js reactjs

我在构建处理时遇到 pdfjs-dist 包的问题。它显示 GitLab 构建映像中存在错误。

节点版本----v14.19.0

pdfjs-dist 版本-2.13.313

/app/node_modules/pdfjs-dist/build/pdf.js:2440
    return this._jsActionsPromise ||= this._transport.getPageJSActions(this._pageIndex);
                                  ^^^
SyntaxError: Unexpected token '||='
    at wrapSafe (internal/modules/cjs/loader.js:988:16)
    at Module._compile (internal/modules/cjs/loader.js:1036:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/app/node_modules/@react-pdf-viewer/core/lib/cjs/core.min.js:1:94)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) {
  type: 'SyntaxError'
}
Run Code Online (Sandbox Code Playgroud)

小智 1

升级到节点 16 解决了我的问题,您可能想尝试一下(当然,如果可能的话):)