-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Describe the bug
When using Vite to package a React app, we hit some issues because:
- The ESM that
@react-pdf/rendererprovides doesn't seem to provide the same exports as the CJS module. - There is server code included in the ESM, but this library is a browser module.
To Reproduce
You can reproduce with this repository: https://github.com/thekevinbrown/vite-react-pdf-reproduction
Expected behavior
I expected React PDF to be able to be bundled and used in an ESM context.
Screenshots
Uncaught ReferenceError: global is not defined
at node_modules/blob/index.js (@react-pdf_renderer.js:554)
at __require (chunk-KVFJW2XH.js:12)
at node_modules/blob-stream/index.js (@react-pdf_renderer.js:616)
at __require (chunk-KVFJW2XH.js:12)
at @react-pdf_renderer.js:126368Desktop (please complete the following information):
- OS: MacOS
- Browser: Chrome
- React-pdf version: "@react-pdf/renderer": "^2.0.12",
Additional Notes
An issue was logged with Vite here: vitejs/vite#3405
This may be related to this issue as well: #1029
I'd be happy to help with a PR if one is welcome, just wanted to check to ensure I wasn't duplicating effort and that this was something you'd accept a PR for.
avanvik, gla23, MattMattC, ghry5 and juliolmullersasivarnan, MattMattC and Keshish