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

Please help testing next React-PDF release! #748

Closed
wojtekmaj opened this issue Mar 18, 2021 · 17 comments
Closed

Please help testing next React-PDF release! #748

wojtekmaj opened this issue Mar 18, 2021 · 17 comments
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@wojtekmaj
Copy link
Owner

wojtekmaj commented Mar 18, 2021

Folks,

React-PDF 5.3.0 is just around the corner, with several exciting updates:

Please help me with testing v5.3.0-beta.2 by:

Please comment what you checked and whether your test was successful.

Your help is invaluable. Thank you in advance!

@imustafin
Copy link

This is about #659.

I am using react-rails. My previous comment #659 (comment)

I upgraded react-pdf to 5.3.0-beta:
package.json

...
    "react-pdf": "^5.3.0-beta",
...

yarn.lock

...
react-pdf@^5.3.0-beta:
  version "5.3.0-beta"
  resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-5.3.0-beta.tgz#a421b75e476b65e18a2b4da8087c4cc1617d94e3"
  integrity sha512-9pRckeUcCOFe+0iNnaSbiltckRdUa6LHr8e5waC77+/+6j2Yz4UAF/9w7ED9RL68EnWxv21GFmFE4DHt5zmvAw==
  dependencies:
    "@babel/runtime" "^7.0.0"
    make-cancellable-promise "^1.0.0"
    make-event-props "^1.1.0"
    merge-class-names "^1.1.1"
    merge-refs "^1.0.0"
    pdfjs-dist "2.6.347"
    prop-types "^15.6.2"
    worker-loader "^3.0.0"

pdfjs-dist@2.6.347:
  version "2.6.347"
  resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-2.6.347.tgz#f257ed66e83be900cd0fd28524a2187fb9e25cd5"
  integrity sha512-QC+h7hG2su9v/nU1wEI3SnpPIrqJODL7GTDFvR74ANKGq1AFJW16PH8VWnhpiTi9YcLSFV9xLeWSgq+ckHLdVQ==
...

Importing in TS like this:

import { Document } from 'react-pdf';
import { Page } from 'react-pdf';

or like this:

import { Document } from 'react-pdf/dist/esm/entry.webpack';
import { Page } from 'react-pdf/dist/esm/entry.webpack';

Still doesn't work.

The error is

ERROR in ./node_modules/react-pdf/dist/esm/Page/AnnotationLayer.js 195:8-29
"export 'AnnotationLayer' (imported as 'pdfjs') was not found in 'pdfjs-dist'
    at HarmonyImportSpecifierDependency._getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1463:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/var/www/app_name/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1253:28)
    at /var/www/app_name/node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1185:12
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

ERROR in ./node_modules/react-pdf/dist/esm/entry.webpack.js 14:2-27
"export 'GlobalWorkerOptions' (imported as 'pdfjs') was not found in 'pdfjs-dist'
    at HarmonyImportSpecifierDependency._getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1463:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/var/www/app_name/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1253:28)
    at /var/www/app_name/node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1185:12
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

ERROR in ./node_modules/react-pdf/dist/esm/Document.js 96:28-55
"export 'PDFDataRangeTransport' (imported as 'pdfjs') was not found in 'pdfjs-dist'
    at HarmonyImportSpecifierDependency._getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1463:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/var/www/app_name/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1253:28)
    at /var/www/app_name/node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1185:12
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

ERROR in ./node_modules/react-pdf/dist/esm/Page/PageSVG.js 91:25-42
"export 'SVGGraphics' (imported as 'pdfjs') was not found in 'pdfjs-dist'
    at HarmonyImportSpecifierDependency._getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1463:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/var/www/app_name/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1253:28)
    at /var/www/app_name/node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1185:12
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

ERROR in ./node_modules/react-pdf/dist/esm/Document.js 195:34-51
"export 'getDocument' (imported as 'pdfjs') was not found in 'pdfjs-dist'
    at HarmonyImportSpecifierDependency._getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (/var/www/app_name/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1463:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/var/www/app_name/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (/var/www/app_name/node_modules/webpack/lib/Compilation.js:1253:28)
    at /var/www/app_name/node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (/var/www/app_name/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:22)
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1185:12
    at /var/www/app_name/node_modules/webpack/lib/Compilation.js:1097:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

This fix #659 (comment) worked in react-pdf 5.2.0.

This also helps in react-pdf 5.3.0-beta

@paescuj
Copy link
Contributor

paescuj commented Mar 19, 2021

Regarding #657 - it's working for me with Next.js now 👍 Thank you!

1 similar comment
@LuisPerez94
Copy link

Regarding #657 - it's working for me with Next.js now 👍 Thank you!

@paescuj
Copy link
Contributor

paescuj commented Mar 29, 2021

I get the following warning now:

Warning: Failed prop type: Attempted to check if a variable is a File on a non-browser environment.
    at Document ([...]/node_modules/react-pdf/dist/umd/Document.js:78:37)

Using Next.js and loading react-pdf as follows:

import { Document, Page, pdfjs } from 'react-pdf';

pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

Otherwise 5.3.0-beta works great!

@wojtekmaj
Copy link
Owner Author

wojtekmaj commented Mar 29, 2021

@paescuj - Thanks! Fixed this "Failed prop type" issue in 8ec1c3a. Nice catch!

@paescuj
Copy link
Contributor

paescuj commented Mar 30, 2021

@wojtekmaj Great, thanks!

@wojtekmaj
Copy link
Owner Author

wojtekmaj commented Apr 1, 2021

React-PDF v5.3.0-beta.2, landed with improvements regarding loading PDF.js worker.

Just tested and it works very well in both Webpack and CRA using Webpack instructions.

@po5i
Copy link

po5i commented Apr 1, 2021

@wojtekmaj I couldn't find any updated instructions at the v5.3.0-beta.2 README file. How does the worker line CDN change for CRA?

@wojtekmaj
Copy link
Owner Author

wojtekmaj commented Apr 1, 2021

@po5i I just updated the docs: https://github.com/wojtekmaj/react-pdf#create-react-app

tl;dr For CRA:

  • (new) use Webpack entry
  • or copy pdf.worker.js from node_modules/pdfjs-dist/build to /public and keep using "standard" entry. No need to adjust workerSrc manually unless you want to load the worker from CDN or want to use pdf.worker.min.js instead.

@adderpositive
Copy link

It works fine on my project running on Next.js. I am using 5.3.0-beta.3. Thanks.

@sbodi10
Copy link

sbodi10 commented Apr 14, 2021

Also had the same issue listed here: #613 (comment)
Updating version to v5.3.0-beta.2 worked!

Thanks @wojtekmaj

@mahyaa21
Copy link

My project is running on Next.js. I am using 5.3.0-beta.3 version but my document does not load without any errors. It just shows a message that says Loading PDF….
Could you please help me with this problem? @wojtekmaj

@paescuj
Copy link
Contributor

paescuj commented Apr 17, 2021

My project is running on Next.js. I am using 5.3.0-beta.3 version but my document does not load without any errors. It just shows a message that says Loading PDF….
Could you please help me with this problem? @wojtekmaj

Have you configured it as described under https://github.com/wojtekmaj/react-pdf#standard-browserify-and-others? Any errors in the console?

@mahyaa21
Copy link

My project is running on Next.js. I am using 5.3.0-beta.3 version but my document does not load without any errors. It just shows a message that says Loading PDF….
Could you please help me with this problem? @wojtekmaj

Have you configured it as described under https://github.com/wojtekmaj/react-pdf#standard-browserify-and-others? Any errors in the console?

Thank you so much! My problem is resolved :)

@jplew
Copy link

jplew commented May 5, 2021

FYI, I was getting this error with 5.2.0:

./node_modules/worker-loader/dist/cjs.js!./node_modules/react-pdf/dist/esm/pdf.worker.entry.js
TypeError: Cannot read property 'version' of undefined

> Build error occurred
Error: > Build failed because of webpack errors
    at /home/jplew/Sites/greenflower/lxp/node_modules/next/dist/build/index.js:17:924
    at async Span.traceAsyncFn (/home/jplew/Sites/greenflower/lxp/node_modules/next/dist/telemetry/trace/trace.js:6:584)

using this code:

import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';

Ever since updating to 5.3.0-beta.3 the problem went away. Thanks! 🥳

Framework: Next.js 10
Webpack 5
npm@7.0.15
node@v15.4

@wojtekmaj wojtekmaj unpinned this issue May 8, 2021
@wojtekmaj
Copy link
Owner Author

I see that in general nothing horrible has happened with the beta, so I released v5.3.0 officially. Thanks for your feedback!

@paescuj
Copy link
Contributor

paescuj commented May 8, 2021

Great! Thank you @wojtekmaj!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

9 participants