Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find variable: on #1844

Open
4 tasks done
ildar945k opened this issue Jul 17, 2024 · 0 comments
Open
4 tasks done

Can't find variable: on #1844

ildar945k opened this issue Jul 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ildar945k
Copy link

ildar945k commented Jul 17, 2024

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

Some users are getting error trying to preview pdf:

Can't find variable: on

at webpack:///node_modules/pdfjs-dist/build/pdf.mjs. line: 15417. column: 38. name: at webpack:///node_modules/pdfjs- dist/build/pdf.mjs. line: 18573. column: 0. name: at webpack:///webpack/bootstrap. line: 19. column: 36. name: module at webpack:///node_modules/react-pdf/dist/cjs/index.js --

"react-pdf": "9.0.0", "pdfjs-dist": "4.3.136", "webpack": "5.90.3", "react": "18.2.0",

      if (typeof Promise.withResolvers === "undefined") {
               if (window) {     
                    window.Promise.withResolvers = function() {
                      let resolve, reject;
                      const promise = new Promise((res, rej) => {
                        resolve = res;
                        reject = rej;
                      });
                      return { promise, resolve, reject };
                    };
              }
      }
    
    pdfjs.GlobalWorkerOptions.workerSrc = new URL(
      "pdfjs-dist/legacy/build/pdf.worker.min.mjs",
      import.meta.url
    ).toString();

``

Steps to reproduce

No way to repro

Expected behavior

No error

Actual behavior

Error

Additional information

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Bundler name and version (if applicable):
@ildar945k ildar945k added the bug Something isn't working label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant