OnedocLabs / react-print-pdf

Build and generate PDF using React 📄 UI kit for PDFs and print documents. Simple, reusable components and templates to create great invoices, docs, brochures. Use your favorite front-end framework React to build your next PDF.
https://docs.fileforge.com/react-print/welcome/getting-started
Apache License 2.0
2.31k stars 87 forks source link

react-print/server module not found #11

Closed s-hamdananwar closed 8 months ago

s-hamdananwar commented 8 months ago

Trying to import Tailwind component according to this documentation results in error: Cannot find module '@onedoc/react-print/server' or its corresponding type declarations. I am trying to use it in Next.js server side components.

Titou325 commented 8 months ago

Hey @s-hamdananwar there seemed to be a packaging issue in the server build. It should be updated in version 0.1.120.

We have had reports of issues when running in a treeshaken environment such as Next.js serverless functions when deployed but it should work fine locally. We are working with the Tailwind team to see how we can get away with not having a file system.

kjell0w commented 8 months ago

Hey, i know this issue is closed but i do encounter the same problem with version 0.1.127 in a NextJS App when running locally in dev mode. I don't know if it's even supposed to work in a code sandbox, but I was able to reproduce this there as well. https://codesandbox.io/p/devbox/next-js-fxis37

Titou325 commented 8 months ago

Hey @kjell0w, the current 0.1.127 version does have a server export. I can't seem to find the reproduction in the sandbox, it links to a basic next app without the dependencies :/

kjell0w commented 8 months ago

@Titou325 Thanks for your quick response. Sorry my bad, someshow shared a wrong URL. The compile function is imported in app/api/print/route.ts . https://codesandbox.io/p/devbox/modest-morning-cmy95m

Titou325 commented 8 months ago

Hey @kjell0w, indeed I was able to reproduce the error. As of now, the /server import is equal to client as we have fixed Tailwind support.

I have fixed your sandbox at https://codesandbox.io/p/devbox/cranky-moon-fy7mhx

kjell0w commented 8 months ago

@Titou325 Yes that works, thanks alot!