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

High memory usage when building CRA example #11410

Closed
abonckus opened this issue Dec 16, 2019 · 10 comments · Fixed by #11415
Closed

High memory usage when building CRA example #11410

abonckus opened this issue Dec 16, 2019 · 10 comments · Fixed by #11415

Comments

@abonckus
Copy link

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

@astrada
Copy link

astrada commented Dec 16, 2019

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.

@timvandermeij
Copy link
Contributor

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.

@abonckus
Copy link
Author

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?

@astrada
Copy link

astrada commented Dec 17, 2019

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

@timvandermeij
Copy link
Contributor

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.

@abonckus
Copy link
Author

abonckus commented Dec 18, 2019

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?

@midgethoen
Copy link

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...

@midgethoen
Copy link

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

@timvandermeij
Copy link
Contributor

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.

@Athelian
Copy link

Athelian commented Jun 20, 2022

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

I tried patching the //# sourceMappingURL comments out of this package for my repository but I'm still failing to build my app on remote. I also tried upgrading Babel, but I'm on the verge of uninstalling this package altogether. I'm using the legacy folder.

If anyone has any other tips on how to fix this please let me know 🙏🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants