nbd-wtf / nostr-tools

Tools for developing Nostr clients.
The Unlicense
661 stars 184 forks source link

moduleResolution as bundle #388

Open antonioconselheiro opened 4 months ago

antonioconselheiro commented 4 months ago

NIPs that are not exported by default depend on the typescript configuration moduleResolution set as bundle.

image

I'm suggesting that it would be a good idea to include information about the need for this configuration in readme.md.

Maybe it's something obvious that I didn't understand, but it took me a while to understand out how to import these modules:

https://njump.me/note1d750tkpzs6lh5260x0z3r7w2n79ek82r9mg0kazmp6nms0ys8k9stvntte

fiatjaf commented 4 months ago

I am sorry, but the JavaScript ecosystem is ridiculous. The way dependencies and package managers and preprocessers and bundlers interact with each other changes all the time in a way that is not sane and this repository cannot help with that.

Maybe we should add a note saying that you are expected to have a PhD in Javascript Sciences before using the package?

alexgleason commented 4 months ago

Sorry, I may have broken it here: https://github.com/nbd-wtf/nostr-tools/commit/db53f371613380109967b22bc21d6ddf637643f1 Did not realize that would affect downstream packages. This is the correct setting for modern TypeScript, though.

alexgleason commented 4 months ago

It seems like we could change it to nodenext to make it work both ways.

antonioconselheiro commented 4 months ago

Just a suggestion, if you think it doesn't apply we can close the issue.

alexgleason commented 4 months ago

Nah you're probably not the only person going to experience this issue. I changed it to NodeNext in 6b43533f2eb70327d132d8faaf1e3c0f6e84b172 just now. Hopefully that will fix this issue.

antonioconselheiro commented 4 months ago

if these changes are confirmed I will no longer need my configuration moduleResolution set as bundle in my project?

alexgleason commented 4 months ago

You should still be using NodeNext or Bundler for modern projects. There's no reason to go back if you got it working. But I'm trying to fix it so it'll work both ways.

alexgleason commented 4 months ago

I think my commit will fix it. We need another version deployed to test it out.

@fiatjaf I ended up ripping out the GitHub actions for JSR because it's not working. I'll fix it later.