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

replace got with builtin fetch #14

Open
jimmywarting opened this issue Jan 4, 2025 · 3 comments
Open

replace got with builtin fetch #14

jimmywarting opened this issue Jan 4, 2025 · 3 comments

Comments

@jimmywarting
Copy link

No description provided.

@lpgera
Copy link
Owner

lpgera commented Jan 5, 2025

Hi @jimmywarting!

May I ask you what's your main motivation for replacing got with native fetch?

Asking because my intention was to keep using got until Node version 22 is more widely adopted, otherwise dirigera would throw experimental warnings on the console. (Native fetch became stable in Node 22.) I've not heard about any issues with got inside dirigera, so I'd be curious to hear more about it if you bumped into any!

@jimmywarting
Copy link
Author

reason was to use standard apis and making it more widely adopted on other platform other than nodejs
fetch works anywhere, deno, bun, cloudflare worker, web, service worker etc.

got also brings in a ton of other sub dependencies: https://npmgraph.js.org/?q=dirigera

I'm a bit of a PackagePhobia nerd... fewer dependencies the better imo, every dependency is a further risk of chain attacks.

but the main reason was that i tried to host some small proof of concept on a free hosting services, i first tried some deno deploy, then something bun recommended but both did not work so well, then i found vercel hosting and it did work wonders.

but one of bun or deno deployment complained that got was one of the main reason it failed to build, but i did not think it was b/c of your project. b/c the stack trace did not seem to come from this project (judging by the stack trace) if i remember correctly...
either way now this isn't a issue for me anymore, but i would still like it if you could switch from got to fetch.

@lpgera
Copy link
Owner

lpgera commented Jan 24, 2025

Makes total sense, thanks for the explanation! I agree with you that minimizing the number of dependencies is a great thing, and not just because of the size of the library, but also in order to reduce security risks and to increase compatibility with different runtimes.

I'll do some testing to see how the lib would behave with different Node versions if I switched to fetch, and will probably make this happen in the near future.

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

2 participants