wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.11k stars 867 forks source link

Code Sample for React PDF in Vite Not Working Due to Missing React Dependency in Plugin in the vite.config.js #1683

Closed dev-phantom closed 6 months ago

dev-phantom commented 7 months ago

Before you start - checklist

Description

The code sample provided for React PDF in Vite is currently not functional, as the React dependency is not included in the plugin. This issue is observed in the following location:

Repository: wojtekmaj/react-pdf

Issue Details

When attempting to run the code sample in Vite, it fails to recognize React components due to the missing React dependency. This prevents the proper rendering of the React PDF component.

Possible Solution

Include React as a dependency in the Vite plugin configuration or update the documentation to guide users on how to include React when using the Vite setup.

Thank you for your attention to this matter. Let me know if any further details are required.

Steps to reproduce

  1. Clone the repository: git clone https://github.com/wojtekmaj/react-pdf.git
  2. Navigate to the Vite sample: cd react-pdf/sample/vite
  3. Install dependencies
  4. Run the development server

Expected behavior

The React PDF component should render successfully in the Vite environment.

Actual behavior

The code execution fails, and the console logs indicate that React is not recognized as a dependency.

Additional information

No response

Environment

wojtekmaj commented 6 months ago

Odd, works for me without any modifications:

image
dev-phantom commented 6 months ago

Okay closing this in a bit