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

Issue when using SSR + React (next.js) #20

Closed
harshzalavadiya opened this issue Mar 9, 2020 · 2 comments
Closed

Issue when using SSR + React (next.js) #20

harshzalavadiya opened this issue Mar 9, 2020 · 2 comments

Comments

@harshzalavadiya
Copy link

Thank you for making such an amazing exif parser, compare to others it's really easy to use 👍

Until exifr v2.x I was able to import exifr normally and use ESM module perfectly fine but in v3 and latest v4 it throws SSR error when rendering page using next.js (works fine client side rendered applications i.e. create-react-app)

pfb minimal example reproducing error if we use v2.x and after restarting CSB server you can see that it works just fine

Example Sandbox
v4: (error) - https://codesandbox.io/s/damp-wood-mgfq5
v2: (works) - https://codesandbox.io/s/fragrant-cookies-jtenv

@MikeKovarik
Copy link
Owner

Hello. Thanks for the kind words. I'm glad you like it. :)

Also thank you for the sandboxes. It always tremendously helps with tracking down the issue. I'm trying to cover everything with tests but I'm unable to use and test all tools and frameworks. ;)

What's going on is the change how Nodejs works with ESM. From Node 13 we can (or should) use "type":"module" in package.json instead of using .mjs extension. Exifr tried to follow this new way of doing ESM but tools and frameworks aren't yet ready for it as it seems.

So I will probably backtrack on this and make UMD (for now while the ecosystem transitions) as the main entry point of the library to make sure it works everywhere. I will also rename dist/full.esm.js to dist/full.esm.mjs so there's the esm variant available as well.

Unless something breaks there will be v5.0.0 in the coming days.

Thank you

@MikeKovarik
Copy link
Owner

4.3.0 released. I hope it solved your problem

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