Update webpack.js to support browsers that do not have the Web Workers API

This commit is contained in:
Franck Freiburger 2017-05-26 17:46:41 +02:00 committed by Franck Freiburger
parent 8d55e6a01d
commit a0b7f84461

View File

@ -16,6 +16,11 @@
var pdfjs = require('./build/pdf.js'); var pdfjs = require('./build/pdf.js');
var PdfjsWorker = require('worker-loader!./build/pdf.worker.js'); var PdfjsWorker = require('worker-loader!./build/pdf.worker.js');
if (typeof window !== 'undefined' && 'Worker' in window) {
pdfjs.PDFJS.workerPort = new PdfjsWorker(); pdfjs.PDFJS.workerPort = new PdfjsWorker();
} else {
pdfjs.PDFJS.disableWorker = true;
}
module.exports = pdfjs; module.exports = pdfjs;