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
[BUG] tweetnacl
library causes bundling issues in various configurations
#180
Comments
Hi @pospi, to reproduce this problem and test with a replacement, can I set up a rollup and web dev server project and use tweetnacl in it? tweetnacl-ts is even older, but it promises TS and bundler support. I want to test that before making a decision. |
You should be able to, yeah- a WDS config similar to this one should reproduce (differently) the bug with or without the I don't know that |
I can reproduce the problem, I believe. Running WDS with tweetnacl commonjs-rollup'd in the web-dev-server.config results in a "no default export in tweetnacl" error in the browser. I'm looking for a replacement that is compatible with ES modules. |
I've found a great replacement for tweetnacl and it works well: https://www.npmjs.com/package/@noble/ed25519 When trying the client in WDS, isomorphic-ws is giving me grief. It's somewhat semi-CJS/ESM. I'm looking for a fix and will then release the client as WDS-compatible ;-) |
I've chimed in on the commonjs issue in the WDS repo modernweb-dev/web#1700 (comment) |
This has been a time-consuming endeavor, and it's still not working. I've submitted another issue with WDS because I can't even use |
v0.14.0 is released with the replaced NPM package. I'll open a new issue for WDS compatibility, even though the JS client can only wait for the WDS issues to be fixed. |
Describe the bug
This library is a very mature nodejs package (read: old & infrequently updated). Being in an older format can cause compatibility issues with more modern development environments and build tooling.
Presently it has become problematic in neighbour-hoods/applet-template#9 (comment). I wish I'd been tracking other times it has been an issue with bundlers, 'cos this is not the first time I've had to go into arcane Nodejs internals because of its presence in the stack.
Expected behavior
Developers shouldn't have to think about this module's compatibility with TypeScript, Rollup, Webpack, Web Dev Server, Babel, ESM modules or anything else. At least, not beyond the normal level of consideration that would apply to any other module being included in a project.
Could we try swapping it out for tweetnacl-ts or another alternative with broader module compatibility?
The text was updated successfully, but these errors were encountered: