How can I help you?
Uncaught DOMException: Failed to execute ‘importScripts’ on ‘WorkerGlobalScope’
11 Feb 20261 minute to read
An error that can occur when the ej2-pdfviewer-lib assets are missing is the Uncaught DOMException: Failed to execute ‘importScripts’ on ‘WorkerGlobalScope’. This occurs when the PDF viewer’s web worker cannot load required files such as pdfium.js or pdfium.wasm.
To troubleshoot and resolve this error, follow these steps:
-
Check asset availability: Verify that the required files (for example,
pdfium.jsandpdfium.wasm) exist in a public assets folder that the application serves (commonlysrc/assets/ej2-pdfviewer-lib). Confirm the files are present in the build output and that the request paths used by the viewer match their deployed locations. -
Network and CORS: Use the browser developer tools to confirm the asset requests return HTTP 200. If the assets are hosted on a different origin, configure appropriate CORS response headers (for example,
Access-Control-Allow-Origin) or host the assets on the same origin to avoid cross-origin worker load failures.
NOTE
If the
ej2-pdfviewer-libfolder is not available insrc/assets, copy the contents from./node_modules/@syncfusion/ej2-pdfviewer/distintosrc/assets/ej2-pdfviewer-libusing the command:cp -R ./node_modules/@syncfusion/ej2-pdfviewer/dist/ej2-pdfviewer-lib src/assets/ej2-pdfviewer-lib