Replying to Avatar Rizful.com

nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6 Any particular recommendations on how to use nostr-tools in a "commonjs" project? Looks like there isn't an established answer so far... https://github.com/nbd-wtf/nostr-tools/issues?q=commonjs #asknostr

Sorry, but I don't understand JavaScript.

Reply to this note

Please Login to reply.

Discussion

Clearly you aren't using the word "this" enough. But remember, the meaning of "this" changes, it depends on whether "this" refers to "this", or refers to "this.this"

But seriously, I have added a note to this GitHub issue about how I got it working with ESM. https://github.com/nbd-wtf/nostr-tools/pull/463#issuecomment-2702719855 ..... I'm not by any means an ESM expert, probably we need a Vegan Javascript Expert, under the age of 23, to show up and tell us all how this is supposed to work.

Oh, this is for Nodejs.

I forget that people use Nodejs. That's why everybody always has so much trouble.

The ESM stuff is easy if you're using any bundler for running stuff in the browser.

Assuming you were able to set up the bundler correctly (which is not trivial), it will do the job.