aanckar / react-pdf-tailwind

Use Tailwind CSS to style PDFs created with react-pdf
315 stars 11 forks source link

vite.js sample project with packages updated to the latest verion raised error "Uncaught ReferenceError: process is not defined" #16

Closed MarcelMalik closed 1 year ago

MarcelMalik commented 1 year ago

Greetings,

Firstly, I would like to commend you on the excellent library that you have created. However, I have encountered an issue while updating my project and the Vite.js example to the latest version using the command pnpm update --latest.

The issue arises when running the Vite.js project, and the error message states that sharedState.js:30 Uncaught ReferenceError: process is not defined. The error seems to be originating from ../../node_modules/.pnpm/tailwindcss@3.3.0_postcss@8.4.21/node_modules/tailwindcss/lib/lib/sharedState.js.

Screenshot 2023-03-30 um 11 39 02

chrissantamaria commented 1 year ago

Could you clarify which packages you're updating? I tried to reproduce by running pnpm update --latest in the examples/vite directory, which gave the following diff:

dependencies:
- @react-pdf/renderer 3.1.3
+ @react-pdf/renderer 3.1.9

devDependencies:
- @types/react 18.0.27
+ @types/react 18.0.31
- @types/react-dom 18.0.10
+ @types/react-dom 18.0.11
- typescript 4.9.5
+ typescript 5.0.2
- vite 4.1.1
+ vite 4.2.1

After updating, pnpm build still passed without any warnings.

It might be easier if you're able to provide a standalone reproduction repo - would be happy to take a look at that.

MarcelMalik commented 1 year ago

To reproduce, please also update the packages in the root and in the vite.js project. I haven't been able to figure out which package it is yet. Does it seem to me that there is an interaction between the latest tailwindcss and the latest TypeScript version?

chrissantamaria commented 1 year ago

By root do you mean the package itself? If so, I updated with this diff:

dependencies:
- @react-pdf/renderer 3.1.3
+ @react-pdf/renderer 3.1.9
- tailwindcss 3.2.4
+ tailwindcss 3.3.0

devDependencies:
- @react-pdf/types 2.2.0
+ @react-pdf/types 2.3.1
- @types/jest 29.4.0
+ @types/jest 29.5.0
- @types/node 18.13.0
+ @types/node 18.15.11
- jest 29.4.2
+ jest 29.5.0
- tsup 6.6.2
+ tsup 6.7.0
- typescript 4.9.5
+ typescript 5.0.2

and pnpm build in examples/vite still passed.

If you're testing this completely self-contained in the react-pdf-tailwind repo, could you fork + make your own branch with the packages updated? I can test that on my end and see if I can reproduce.

MarcelMalik commented 1 year ago

I apologize for the problems with my explanation. I had carried out the following steps:

  1. Updated the package with pnpm update --latest
  2. Updated the vite.js example with pnpm update --latest
  3. Started the vite.js example with pnpm dev
  4. The error mentioned above occurred in the browser console (google chrome)

However, this error is no longer occurring, as I can see it was fixed a few hours ago in tailwindcss version 3.3.1: https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.3.1 Fix "process is not defined" error (#10919)

Therefore, I am closing this issue and thank you so much for your support.