-
-
Notifications
You must be signed in to change notification settings - Fork 899
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
App crash after import from react-pdf #496
Comments
I had the same error when I upgrade to react-scripts 3.3.0. Adding the following to the .env.development file got things running:
|
The issue appears to be caused by the a recent change to Create React App to make the VSCode debugger able to debug code in node_modules of CRA apps. The problem went away when I experimentally reverted the above change. Of course this isn't a viable way to fix the issue. I wonder if there is as way around the issue using craco (Create React App Configuration Override)? I also wonder if other React components are having this issue? |
There is an issue for Create React App. See: facebook/create-react-app#8130 The user reporting the issue isn't using react-pdf but they are using pdfjs-dist. They found a tempary fix by adding: This worked for us also. |
Please see #498 (comment) - a response to the same issue. |
I found that if you import components from |
Here is my package json
Spun up with It will sit and spin on I ended up removing the package and just using a |
where is .env.developemt present |
@vammu920 Also, I think that will only be used for I haven't tested this solution, but that's my understanding of where they go. |
Ran into this as well. #496 (comment) suggestion worked but that obviously makes debugging a bit more difficult because sourcemaps help in debugging in the browser... |
That's awesome man, I've been stuck for hours. Thank you. |
This comment has been minimized.
This comment has been minimized.
WONDERFULL TIP!!!!! I'ved the same error in the project i'm working now and I applied this command in the scripts > test. Now, everything is running perfectly. Thanks bro! |
adding |
not work with me :( |
When set to false, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines. For CRA in .env For webpack config |
Another solution that I'm going with is downgrading to react-scripts 3.2 |
Please kindly check React-PDF These changes should result in 10-15 seconds faster Webpack builds, as well as you should be able to use Webpack entry file in Create-React-App, without the need of using external CDN for hosting worker. Let me know what you think in #748! |
* Mobie scrollable tab bar from : https://codesandbox.io/s/material-demo-forked-2yw9t?file=/demo.js:990-1097&resolutionWidth=320&resolutionHeight=675 * react-pdf fix for create-react-app: wojtekmaj/react-pdf#496
Before you start - checklist
Description
Short description of the bug you encountered.
When I add the line
Just after I create a new app with create-react-app and add with npm react-pdf,
If import from react-pdf like that :
import { Document } from "react-pdf"
My app can't compile anymore.
Steps to reproduce
Steps to reproduce the behavior:
Create a new app with create-react-app
npx create-react-app test-react-pdf
Install react-pdf
npm install react-pdf
Add in
src/App.js
an import from react-pdfimport { Document } from "react-pdf"
Run npm start and it should display something like:
I also create a repo with the problem https://github.com/ditiz/pdf-viewer
To use it:
git clone https://github.com/ditiz/pdf-viewer.git
npm install
npm start
Expected behavior
What you expected to happen?
Can use react-pdf without crash the app
Additional information
I tried to use more ram with:
react-scripts --max_old_space_size=4096 start
It's change nothing
If applicable, add screenshots (preferably with browser console open) and files you have an issue with to help explain your problem.
Environment
The text was updated successfully, but these errors were encountered: