jwt-decode icon indicating copy to clipboard operation
jwt-decode copied to clipboard

Add support for node hybrid cjs and esm modules

Open perrin4869 opened this issue 3 years ago • 2 comments

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Adds support for loading this module natively as esm from node.js. This also makes it possible to consume this module with the new nodenext and node16 typescript module resolvers. This is not possible in the current state of affairs, because the .d.ts file is written for esm modules while typescript will attempt to load the commonjs version of the package.

References

https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/ https://nodejs.org/api/packages.html#exports

perrin4869 avatar May 26 '22 05:05 perrin4869

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

stale[bot] avatar Sep 21 '22 05:09 stale[bot]

I'm still interested in this PR just in case 😄

perrin4869 avatar Sep 21 '22 05:09 perrin4869

Another idea, now that ESM is widely supported in all versions of Node.js. Why not drop CommonJS compatibility and remove the build step entirely?

jonkoops avatar Oct 27 '22 16:10 jonkoops

I'm all for it, if that's the direction @frederikprijck agrees to take this module in I'll update this PR

perrin4869 avatar Oct 28 '22 03:10 perrin4869