Pdf.js: High memory usage when building CRA example

Created on 16 Dec 2019  路  9Comments  路  Source: mozilla/pdf.js

Attach (recommended) or Link to PDF file here: (any pdf produces the same result)

Configuration:

  • Web browser and its version: Google Chrome 79.0.3945.79
  • Operating system and its version: Windows 10 Enterprise 1903
  • PDF.js version: 2.2.228
  • Is a browser extension: false
  • Node version: 12.13.1
  • NPM version: 6.13.4
  • Create React App version: 3.3.0
  • React version: 16.12.0
  • React-scripts version: 3.3.0

Steps to reproduce the problem:

  1. Create new react app with create-react-app
  2. npm install pdfjs-dist
  3. Copy example
  4. npm start or npm run build

What is the expected behavior? (add screenshot)
Start or build succesfully

What went wrong? (add screenshot)

  • Very high memory usage
    Memory usage
  • Fails with error
    NpmError
1-dependencies 3-upstream

Most helpful comment

Thank you all for helping out with reporting this upstream! It looks like there is already a pull request upstream to fix it, so that's great. Once it's merged and released, we can update Babel to fix it on our side as well.

All 9 comments

I'm experiencing the same issue. I did some tests ejecting, trying to pinpoint the issue, and it looks like the problem starts with @babel/core version 7.7.0+. If you eject and downgrade @babel/core to version 7.6.4, it works again for me.

This looks like a Babel regression then. Do you know if this is already reported upstream? If not, it should be reported to Babel so it can be fixed there.

I searched through babel issues, and it doesnt seem to be reported yet. Is there anything specific that you want me to tell them to make it more clear?

@artisb45 I've uploaded a repo to test the issue with the CRA example: https://github.com/astrada/pdf.js-cra-test

Thank you all for helping out with reporting this upstream! It looks like there is already a pull request upstream to fix it, so that's great. Once it's merged and released, we can update Babel to fix it on our side as well.

Cheers, helped me out a lot aswell. For anyone who runs into this until it is merged, try overwriting node_modules/@babel/core/lib/transformation/normalize-file.js with this file as mentioned in the PR.

Edit:
I tried replacing the file, but no success there, anyone got it to work?

I tried replacing the file, but no success there, anyone got it to work?

patching @babel/core7.7.5 with the mentioned file doesnt fix the error for me either...

However, When I delete the //# sourceMappingURL ... comments from the pdfjs-dist package I can get CRA to run again.

unfortunately I have no experience with troubleshooting these memory problems so im kind of stabbing in the dark here. Im not sure how i can be of more help

The upstream issue got fixed and we updated our dependency version too, so it's also fixed on our side now for the next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agilgur5 picture agilgur5  路  32Comments

BadFriend picture BadFriend  路  38Comments

collinanderson picture collinanderson  路  29Comments

Vanuan picture Vanuan  路  34Comments

oddjobz picture oddjobz  路  46Comments