I am running into issues rendering components stable and consistent the majority of the times without the error that would appear for a chakra-ui & NextJS build:
Error
Error: <LibraryComponent> is a web specific API. You're either using this component on Node, or your bundler is not loading react-pdf from the appropriate web build.
I followed the initial instructions exactly for webpack, only with slight variation due to NextJS's next.config.js file having built in webpack below:
To render stable components without provided error.
Actual behavior
Giving provided error, at times renders the sub components such as Document or Text, but not components such as PDFViewer but instead would at the top level allow the app to render fine implementing {PDFViewer} for the file _app.tsx.
Environment
Browser: Chrome
React-PDF version: "^2.1.1"
React version: "^17.0.2"
Webpack version (if applicable): NextJS's built in webpack. (Next verison: "^12.1.0") [webpack 5]
Description
I am running into issues rendering components stable and consistent the majority of the times without the error that would appear for a chakra-ui & NextJS build:
Error
I followed the initial instructions exactly for webpack, only with slight variation due to NextJS's
next.config.js
file having built in webpack below:I initially did use the provided code:
as
but that at times did gave me at the start of running
yarn dev
issues with nextJS being able to compile the fallback manifest json.here is the NextJS + Chakra _app.tsx:
but if I changed the current return this weird setup, I'm able to render the some sub components of the library like
Document
orText
below:Steps to reproduce
Base App with Chakra for NextJS:
NextJS webpack config:
Expected behavior
To render stable components without provided error.
Actual behavior
Giving provided error, at times renders the sub components such as
Document
orText
, but not components such asPDFViewer
but instead would at the top level allow the app to render fine implementing{PDFViewer}
for the file_app.tsx
.Environment