Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.5.0: global is not defined #529

Closed
mofux opened this issue Dec 18, 2023 · 3 comments · Fixed by #530
Closed

v4.5.0: global is not defined #529

mofux opened this issue Dec 18, 2023 · 3 comments · Fixed by #530

Comments

@mofux
Copy link

mofux commented Dec 18, 2023

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:

const AbortSignal = global.AbortSignal || require('abort-controller').AbortSignal
const AbortController = global.AbortController || require('abort-controller').AbortController

@mcollina
Copy link
Member

I could only track those two places.

@mofux
Copy link
Author

mofux commented Dec 18, 2023

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

const AbortSignal = global.AbortSignal || require('abort-controller').AbortSignal
const AbortController = global.AbortController || require('abort-controller').AbortController

@mofux
Copy link
Author

mofux commented Dec 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants