Skip to content

electron and web workers #6932

Description

@cvlmtg

Hi, we are developing an app which runs in the browser and as an electron app. There's been a release that has introduced this code:

if (typeof module !== 'undefined' && module.require) {
   // node.js - disable worker and set require.ensure.
   PDFJS.disableWorker = true;
   ...

The problem is that module.require exists in electron too, so web workers are disabled even if they should not. I patched pdf.js this way:

if (typeof window === 'undefined' && typeof module !== 'undefined' && module.require) {
   // node.js - disable worker and set require.ensure.
   PDFJS.disableWorker = true;
   ...

and it seems to work. I think this patch should not cause other unwanted troubles, so could it be possibile to add it to pdf.js?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions