You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comment:
Not sure where to post this, but thought it might be helpful to others
Issue:
When using the PDF viewer inside a page of the new app folder layout, regardless if you use "use client" at the top of the document, the file will still be run on the server. Causing the pdfjs code to require("canvas"), which throws an error saying module not found.
Solution:
For the component containing the PDF viewer, disable SSR and use a dynamic import instead.
Run import from "use client" component
Comment:
Not sure where to post this, but thought it might be helpful to others
Issue:
When using the PDF viewer inside a page of the new app folder layout, regardless if you use "use client" at the top of the document, the file will still be run on the server. Causing the pdfjs code to require("canvas"), which throws an error saying module not found.
Solution:
For the component containing the PDF viewer, disable SSR and use a dynamic import instead.
Run import from "use client" component
Example
Display.tsx
DynamicPDF.tsx
The text was updated successfully, but these errors were encountered: