公司下壳的版本非常低,不支持es6
chromium Version = 49.0.2623.87
早先是 require('pdfjs-dist'),但是这里面都是es6的代码,xp下直接就崩溃了,换成了es5的打包,问题解决。
这里面还加了try catch 又做了兼容,估计不兼容也应该ok吧
--save
"pdfjs-dist": "2.5.207",
let PDFJS = null
try {
// PDFJS = require('pdfjs-dist')
PDFJS = require('pdfjs-dist/es5/build/pdf.js')
PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/es5/build/pdf.worker.entry.js')
} catch (error) {
console.error('pdfjs-dist error: ', error)
}
标签:dist,49,require,pdfjs,error,PDFJS,xp
From: https://www.cnblogs.com/pengchenggang/p/17062638.html