nodejs / readable-stream

Node-core streams for userland
https://nodejs.org/api/stream.html
Other
1.03k stars 225 forks source link

v4.5.0: global is not defined #529

Closed mofux closed 8 months ago

mofux commented 8 months ago

I just upgraded to readable-stream@4.5.0 and I am now getting this error (using readable-stream in the browser):

global is not defined

I tracked these changes back to this commit, where there are many references to global that did not exist before. I'm wondering if they should be changed to globalThis instead, so it will not crash in browsers (global is only globally defined in node).

Here is one of the affected places for quick reference: https://github.com/nodejs/readable-stream/blob/700d28b674a440ee939d0d88491e9040c45de642/lib/ours/util.js#L5-L6

mcollina commented 8 months ago

I could only track those two places.

mofux commented 8 months ago

There is another occurence in src/util.js. Not sure if it also needs to be changed.

https://github.com/nodejs/readable-stream/blob/700d28b674a440ee939d0d88491e9040c45de642/src/util.js#L5-L6

mofux commented 8 months ago

Thanks for the quick fix and maintaining this package ❤️ I can confirm that my problem is fixed now 🎉