flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.17k stars 90 forks source link

Feature request: add commonjs and esm exports #299

Open ericallam opened 2 months ago

ericallam commented 2 months ago

Currently superjson does not export commonjs, only ESM. It would be great to support both formats. Our package that we use superjson in supports both formats and having superjson be ESM only causes some issues. It's really easy these days to create a dual-package using something like tshy (which is what we use). If you are open to it, I'd be happy to create a PR.

memefella commented 1 month ago

Ya, I feel like whoever made this change isn't living in reality. ESM-only simply doesn't work for any app of medium complexity.

palfaro91 commented 1 month ago

Did you guys find a workaround? @ericallam @Spudfellah

ericallam commented 1 month ago

@palfaro91 unfortunately the only way at the moment is to use dynamic imports.

harijoe commented 2 weeks ago

Going back to ^1.13.3 is a temporary solution