Another way to initialize the pdfjslib is by setting the GlobalWorkerOptions.workerSrc path to the pdf.worker.js file.
var pdflib = require('pdfjs-dist/build/pdf');
pdflib.GlobalWorkerOptions.workerSrc = '/node_modules/pdfjs-dist/build/pdf.worker.js';
I don’t think that Wix gives us access to this path though. The closest I could find was webpack://document-viewer/npm-path//WC_BEGIN/pdfjs-dist/2.5.207/WC_END/pdfjs-dist/build/pdf.js’, but trying to load that script raises a security error. If anyone knows of a way to initialize pdf-dist.js on wix I would greatly appreciate your guidance.