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

OS platforms is required and other Node.js refs #5

Closed
the-homeless-god opened this issue Feb 29, 2024 · 10 comments
Closed

OS platforms is required and other Node.js refs #5

the-homeless-god opened this issue Feb 29, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@the-homeless-god
Copy link
Contributor

image image

Looks like os.platform is not available by default

❯ node --version
v20.6.1

❯ npm --version
np9.8.1
@the-homeless-god
Copy link
Contributor Author

Looks like a lot of Node.js references.

@the-homeless-god the-homeless-god changed the title OS platforms is required OS platforms is required and other Node.js refs via Vite Feb 29, 2024
@the-homeless-god the-homeless-god changed the title OS platforms is required and other Node.js refs via Vite OS platforms is required and other Node.js refs Feb 29, 2024
@the-homeless-god
Copy link
Contributor Author

Same situation for react-scripts just at the project built from scratch

image

@the-homeless-god
Copy link
Contributor Author

Same for Next.js

It looks like the reason is tailwind

image image image

@Titou325
Copy link
Member

Hey @the-homeless-god, Tailwind support is server-side only so you may be encountering these issues as Tailwind parses a list of files to detect classes. However under our implementation we should be able to get going without scouting all files. I'll have a look

@Titou325 Titou325 self-assigned this Feb 29, 2024
@Titou325 Titou325 added the enhancement New feature or request label Feb 29, 2024
@eliasamaral
Copy link

I face the same issue, and my web application doesn't use Tailwind. The error already appears upon import.

@Titou325
Copy link
Member

Titou325 commented Mar 4, 2024

Hi @eliasamaral @the-homeless-god I am not able to reproduce this on my end. Would you have a sample repo or more repro steps on how you used the library so I can give a better look? Thanks!

@Titou325 Titou325 added bug Something isn't working and removed enhancement New feature or request labels Mar 4, 2024
@the-homeless-god
Copy link
Contributor Author

Hi @eliasamaral @the-homeless-god I am not able to reproduce this on my end. Would you have a sample repo or more repro steps on how you used the library so I can give a better look? Thanks!

I've just created app via create-react-app, or next.js, or vite from scratch
I will create a sample repo for you tomorrow, but the most important thing is:

npx create-react-app
npm i react-print-pdf

and try to configure by guide and start an application. It will fail.

@Titou325
Copy link
Member

Titou325 commented Mar 4, 2024

I would expect vite and create-react-app to fail as they are frontend only and we have an issue with tsup to bundle file system dependencies without a file system. Next should work though.

I'd be glad to take a look at the Next.js example. We use Next as our own backend and it seems to work for us as long as the docs are generated in API or pages rather than client components.

Thank you very much for your help!

@eliasamaral
Copy link

Just creating a clean project in Vite, without any added dependencies, is already enough to encounter the error. Take a look at this repo: https://github.com/eliasamaral/Onedoc_issues_-5/tree/main/vite-project

@Titou325
Copy link
Member

Hey guys!

We dug deeper into this and because of a complex behavior of Tailwind when used with PostCSS, we can't port the Tailwind handling to the client as of now.

Given that the rest of react-print-pdf does not rely on Tailwind and can be ported to the client, we have created a sub-import at @onedoc/react-print-pdf/client that allows import of all client-compatible components without overlap. In the near future we will split each component to a separate bundle to prevent this from happening.

The docs have been updated to show the support for each component (i.e. https://react.onedoclabs.com/components/tailwind)

I will close this issue and create a new one for Tailwind specifically.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants