Skip to content
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

Location of browser version? #23

Open
coolaj86 opened this issue Nov 29, 2022 · 6 comments
Open

Location of browser version? #23

coolaj86 opened this issue Nov 29, 2022 · 6 comments

Comments

@coolaj86
Copy link

Does this exist on a specific CDN?

Are there any instruction for building the browser version?

@rvagg
Copy link

rvagg commented Nov 29, 2022

fwiw I forked and stripped down a version of this for the browser, because I needed it that way: https://github.com/rvagg/ripemd160, you could probably use unpkg or skypack or something like that for it.

I'll be getting around to doing an ESM-only version upgrade of it soon, it's on my list ... like a lot of things.

@coolaj86
Copy link
Author

I get that ESM is 'cool', but when has it ever fixed a problem rather than breaking something that previously worked?

Why not make it more compatible rather than making it cooler?

@rvagg
Copy link

rvagg commented Nov 29, 2022

It's not about making it cooler, it's about compatibility and this project library is part of a much larger suite of libraries that will inevitably get bundled together ... with a bundler, or a native ESM loader like Node.js or the browser. I'm no super-fan of ESM, but it's like Promises, that's where the tide went and fighting it is a painful game and I don't care enough to fight those battles anymore tbh. Upstream from here I need to be ESM compatible, so that's what's going to happen. If you can see a way to make that work for what you need then I'd be happy to integrate. Alternatively, maybe just fork this and modify it for your use? It's simple enough.

@coolaj86
Copy link
Author

Common.js is ESM compatible. Both in browsers and in node.

Nothing that works has ever been broken by not being ESM.

All bundles support commonjs and window and they're not going to drop support for it any time soon.

There's no "tide" to fight against. If you make your stuff compatible, everyone wins.

If you never convert anything to ESM, no one who uses ESM ever loses anything at all.

That said, https://www.npmjs.com/package/@dashincubator/ripemd160

@coolaj86
Copy link
Author

coolaj86 commented Nov 29, 2022

I'm literally going through several modules, forking them, converting them to plain javascript, and at the end of it a bunch of 1.5mb+ bundles from crappy bundles are turning into a few kilobytes.

Everything in the cryptocurrency space depends on about the same 10 modules - this being one of them, which I assume you know because you probably wouldn't be relying on insecure, broken hashes otherwise - all of which were designed for some insanely old version of node (which you know the perils of), and all they need are a few lines changed here and there to work in browsers (Buffer => Uint8Array, the module.exports/window line, etc).

The truth is, most people are still using jQuery. This stuff is just too complicated, and needlessly so. There are simple solutions that require little effort and little education (not your fault, of course), but the elites keep preaching "the future is coming" and "build tools will save us". Meh.

Screen Shot 2022-11-29 at 2 28 36 AM

Build tools will save us...

@lastmjs
Copy link

lastmjs commented May 24, 2023

@coolaj86 Hey this is kind of unrelated, but would you mind enumerating these 10 modules? We're working on a TypeScript Wasm runtime and it would be great to know which packages are mostly used, I'm here trying to get this one to work for some Bitcoin functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants