![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
ky-universal
Advanced tools
Use Ky in both Node.js and browsers
Ky is made for browsers, but this package makes it possible to use it in Node.js too, by polyfilling most of the required browser APIs using node-fetch
.
This package can be useful for:
Note: Before opening an issue, make sure it's an issue with Ky and not its polyfills. Generally, if something works in the browser, but not in Node.js, it's an issue with node-fetch
.
Keep in mind that Ky targets modern browsers when used in the browser. For older browsers, you will need to transpile and use a fetch
polyfill.
npm install ky ky-universal
Note that you also need to install ky
.
import ky from 'ky-universal';
const parsed = await ky('https://httpbin.org/json').json();
// …
ReadableStream
supportFor ReadableStream
support, also install web-streams-polyfill
:
$ npm install web-streams-polyfill
You can then use it normally:
import ky from 'ky-universal';
const {body} = await ky('https://httpbin.org/bytes/16');
const {value} = await body.getReader().read();
const result = new TextDecoder('utf-8').decode(value);
// …
The API is exactly the same as the Ky API, including the named exports.
Use it like you would use Ky:
import ky from 'ky-universal';
const parsed = await ky('https://httpbin.org/json').json();
// …
Webpack will ensure the polyfills are only included and used when the app is rendered on the server-side.
Put the following in package.json:
{
"ava": {
"require": [
"ky-universal"
]
}
}
The library that uses Ky will now just work in AVA tests.
clone()
hangs with a large response in Node - What should I do?Streams in Node.js have a smaller internal buffer size (16 kB, aka highWaterMark
) than browsers (>1 MB, not consistent across browsers). When using Ky, the default highWaterMark
is set to 10 MB, so you shouldn't encounter many issues related to that.
However, you can specify a custom highWaterMark
if needed:
import ky from 'ky-universal';
const response = await ky('https://example.com', {
// 20 MB
highWaterMark: 1000 * 1000 * 20
});
const data = await response.clone().buffer();
FAQs
Use Ky in both Node.js and browsers
The npm package ky-universal receives a total of 0 weekly downloads. As such, ky-universal popularity was classified as not popular.
We found that ky-universal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.