Add support for node hybrid cjs and esm modules
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
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! 🙇♂️
I'm still interested in this PR just in case 😄
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?
I'm all for it, if that's the direction @frederikprijck agrees to take this module in I'll update this PR