npm / web-streams-polyfill
web-streams-polyfill
What changed in web-streams-polyfill 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
6 breaking4 performance1 behavior and defaults1 tooling2 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initweb-streams-polyfill 414 changes
Breaking changes 6
Rejects strings and other non-object values because the argument is converted to an IDL async_sequence.
The package root now provides the ES2015+ ponyfill, replacing the v3 ponyfill/es6 and ponyfill/es2018 imports.
The ES2018 variant is removed in favor of the ES2015 variant.
The ES5+ ponyfill import replaces the v3 ponyfill import.
The ES2015+ polyfill import replaces the v3 es6 and es2018 imports.
The ES5+ polyfill import replaces the v3 web-streams-polyfill import.
Performance 4
Adds sideEffects metadata so bundlers can remove unused imports of web-streams-polyfill and web-streams-polyfill/es5; only the polyfill entry points are marked as having side effects.
Reduces allocations and promise overhead throughout the implementation, including in pipeTo(), tee(), and async iteration.
When a chunk is available in the stream’s internal queue, reads now return a resolved promise using Promise.resolve(), which is slightly faster.
All code in the published package is minified to reduce download size.
Behavior and default changes 1
When chunks are available in the internal queue, pipeTo() reads them in a single batch and writes them to the destination while respecting backpressure.
Tooling 1
The import condition for the package and its /es5 subpath now uses ESM type definitions, so TypeScript no longer treats them as CommonJS types.
Fixes and other changes 2
Creating a ReadableStream without a pull() method no longer schedules a pull or an extra microtask.
Fixes a memory leak where internal promises accumulated when the destination applies backpressure.