0π
β
I tried lot of things but it seems that webpack bring forth many others technicals concepts which increase difficult to understand and correctly import worker. Perhaps it exists other solution into webpack config file but I donβt found.
For now the single solution have found is this :
- copy the worker module (pdfjs-dist) into the node_modules directory to the public directory of your app for respect structure directory
- declare path directly to this public directory and target your worker file (pdf.worker.js)
Those result this code line :
pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs/build/pdf.worker.js'
Source:stackexchange.com