slash
slash copied to clipboard
[Feature]: `@toss/ky` why node-fetch is being used separately when Node.js 18+ has built-in support for fetch
Package Scope
- [x] Add to an existing package
- [ ] New package
Package name: @toss/ky
Overview
Starting from Node.js 18, built-in fetch is supported, making it possible to use without polyfills or the node-fetch library.
Describe the solution you'd like
It seems that we no longer need to use the node-fetch library and can instead use the Node.js built-in fetch, which offers the following pros and cons:
- Pros: Performance improvement of over
25%. (undici benchmarks) - Cons: Currently, the
built-in fetchis in theExperimentalstage (Node.js official documentation)
Even if we continue to use node-fetch due to the experimental stage or other reasons, I believe the phrase "For server-side rendering, we should use the separate ky-universal library." in the documentation should be updated because with Node.js 18 or higher, it is no longer necessary to use ky-universal.