Closed jost-s closed 1 year ago
What is your recommendation for creating a hybrid package with ed25519 that works in Node.js as well as with a bundler
Use noble-curves. It supports hybrid modules and there is no need for a polyfill.
All other solutions that can be implemented in noble-ed25519 will make the library unloadable in browsers without bundlers.
The choice for every library is between:
Thank you for your answers, I didn't receive notifications about them (something wrong with my settings). I understand, makes sense. I'll switch to noble-curves.
I've seen the hint to shim for Node.js <= v18 to augment the global object with webcrypto features, and it works fine when executing in a Node environment. However, when my package that is importing @noble/ed25519 is bundled, the bundler stumbles over the node module import.
A workaround is a conditional async import. That makes all operation asynchronous and the bundlers are outputting warnings and polyfill suggestions.
What is your recommendation for creating a hybrid package with ed25519 that works in Node.js as well as with a bundler?