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

No ESM build? #760

Open
sigma-andex opened this issue Oct 27, 2024 · 4 comments
Open

No ESM build? #760

sigma-andex opened this issue Oct 27, 2024 · 4 comments

Comments

@sigma-andex
Copy link

Is there no ESM build? I'm trying to use it in Remix + Vite and Vite complains that it is a CJS module that cannot be imported.

@MatthewHerbst
Copy link
Owner

Hey @sigma-andex. We don't currently have an ESM build right now unfortunately. ESM should be able to import CommonJS without issue though. Please try import * as reactToPrint from "react-to-print" . Please let me know if that doesn't work.

I tried adding an ESM build before shipping v3 but couldn't figure it out in a reasonable amount of time: mostly had trouble getting the local examples/tests to work. I've been meaning to look into that again, and honestly was waiting for someone to complain, so thank you 😅

I'll try and look at it this week but I can't promise a timeline. If you have experience with this I would massively appreciate any assistance!

@siaikin
Copy link
Contributor

siaikin commented Oct 29, 2024

@MatthewHerbst Any questions, maybe I can help you with something. I can build an esm format, but it's not tested.

@bruno-py
Copy link

bruno-py commented Jan 4, 2025

t me know if that d

I'm on ReactRouter7 and reactToPrint.useReactToPrint throws useReactToPrint is not a function

@MatthewHerbst
Copy link
Owner

@bruno-py you should be importing it by doing import { useReactToPrint } from "react-to-print";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants