Registry / http-networking / vite-compatible-readable-stream

vite-compatible-readable-stream

JSON →
library3.6.1jsnpmunverified

A fork of readable-stream (v3.6.1) modified to remove circular dependencies, ensuring compatibility with Rollup and Vite production builds. It provides Node.js stream primitives (Readable, Writable, Transform, Duplex, PassThrough) in browser environments. Unlike the original readable-stream, this version eliminates circular require/import chains that cause Vite to fail during tree-shaking or bundling. It is primarily intended as a shim for libraries like react-pdf that depend on Node.js streams in browser contexts.

npm install vite-compatible-readable-stream
INSTALL
IMPORT
SIG · VITE-COMPATIBLE-RE
V
vite-compatible-readable-stream
http-networkingjavascriptv3.6.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Readable
import { Readable } from 'vite-compatible-readable-stream'
const Readable = require('vite-compatible-readable-stream').Readable
ESM import is preferred; named exports available for Readable, Writable, Transform, Duplex, PassThrough, pipeline, finished, destroy
Writable
import { Writable } from 'vite-compatible-readable-stream'
import Writable from 'vite-compatible-readable-stream'
Default export is the Readable class; other classes are named exports.
pipeline
import { pipeline } from 'vite-compatible-readable-stream'
import { pipeline } from 'readable-stream'
Use this package instead of readable-stream to avoid Vite build errors.
Stream
import { Readable, Writable, Transform, Duplex, PassThrough } from 'vite-compatible-readable-stream'
import Stream from 'vite-compatible-readable-stream'
No default 'Stream' export; use specific classes.

Creates and consumes a simple readable stream emitting numbers 1 to 5.

import { Readable } from 'vite-compatible-readable-stream'; // Create a readable stream that emits numbers 1 to 5 const numbersStream = new Readable({ objectMode: true, read() { if (this.current === undefined) this.current = 1; if (this.current <= 5) { this.push(this.current++); } else { this.push(null); } } }); // Consume the stream numbersStream.on('data', (chunk) => console.log(chunk)); numbersStream.on('end', () => console.log('Stream ended.')); // Output: // 1 // 2 // 3 // 4 // 5 // Stream ended.
Debug
Known issues
breakingvite-compatible-readable-stream v3.6.1 may not be compatible with Node.js versions below 6.
fix
Upgrade to v3.6.1 or ensure Node.js >= 6.
affects: <3.6.1
gotchaThis package removes circular dependencies from readable-stream, but it may not behave identically to the original readable-stream in edge cases.
fix
Test thoroughly if migrating from readable-stream to this fork.
affects: >=0.0.0
breakingDefault export is the Readable class, not a stream factory. Use named exports for other stream types.
fix
Change `import Stream from 'vite-compatible-readable-stream'` to `import { Readable } from 'vite-compatible-readable-stream'`.
affects: >=3.0.0
gotchaDo not use the original 'readable-stream' package in Vite builds to avoid 'Module parse failed: Unexpected token' errors.
fix
Replace all imports from 'readable-stream' with 'vite-compatible-readable-stream'.
affects: >=0.0.0
deprecatedThe package's repository is a fork of readable-stream; future updates may lag behind upstream.
fix
Monitor upstream readable-stream releases and consider alternatives if features are missing.
affects: >=3.6.1
gotchaThis package is intended for browser/Vite usage; in Node.js environments, prefer the native 'stream' module.
fix
Use conditional imports or detect environment to switch between native stream and this polyfill.
affects: >=0.0.0
Errors
Common errors & fixes
Module parse failed: Unexpected token (1:44) at ... You may need an appropriate loader to handle this file type.
Using the original 'readable-stream' package in a Vite build without proper transpilation.
fix
Replace 'readable-stream' with 'vite-compatible-readable-stream' in package.json and imports.
Uncaught TypeError: stream.push is not a function
Using the wrong stream class (e.g., Writable when you need Writeable).
fix
Ensure you are using correct class: Readable for readable streams, Writable for writable streams.
Cannot find module 'vite-compatible-readable-stream'
Package not installed or not found in node_modules.
fix
Run `npm install vite-compatible-readable-stream` or add to package.json dependencies.
The requested module 'vite-compatible-readable-stream' does not provide an export named 'Stream'
Importing a default 'Stream' export which does not exist.
fix
Import specific classes: `import { Readable, Writable, Transform, Duplex, PassThrough } from 'vite-compatible-readable-stream'`.
Upgrade
Version history
3.6.1latest on npm
Audit
Dependencies
readable-streamrequiredupstream source of stream implementation
Agent activity
25 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources