Next.js Discord

Discord Forum

Unable to use `@react-pdf/renderer` with next14

Unanswered
Naeemgg posted this in #help-forum
Open in Discord
getting this error

20 Replies

its just a simple PDF with nothing fancy in it. it has some texts, links and a qrcode
@Naeemgg getting this error
remove the @react-pdf/renderer from your external packages list. If it's not there, import the component as client component. If the error still persists import the client component without SSR (lazy loading)
@B33fb0n3 remove the @react-pdf/renderer from your external packages list. If it's not there, import the component as client component. If the error still persists import the client component without SSR (lazy loading)
already importing like this
import React from 'react'

import dynamic from "next/dynamic";

const PdfGenerator = dynamic(() => import("@/app/components/React-PDF"), { ssr: false });
const page = () => {
  return (
    <div>
      <PdfGenerator />
    </div>
  )
}

export default page
@Naeemgg it was in external packages, removed it
remove it everywhere where external packages are. Then delete the .next folder and restart your app
let me try
but in dev its giving the same error
@Naeemgg but in dev its giving the same error
did you restarted your dev server?
@B33fb0n3 did you restarted your dev server?
multiple times
deleted .next as well
and you also remove it from the dev external packages (if they exists)?
YEPP
I think I should roll back to jsPdf
I just wanted to try other pdf libraries
while jspdf is working just fine the margin,border,padding and these things are very time consuming
yea, it looks like react-pdf is more a library for react only... and haven't been configured to work for other versions as well..
I wanted to write once and use it for both web and PDF