Skip to content

Commit

Permalink
Change global to globalThis
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Apr 24, 2023
1 parent b5c9163 commit 17349d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import path from 'path';
* since we use a git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any identifier allowed by git.
*/

if (global.ReadableStream === undefined && typeof process !== 'undefined') {
if (globalThis.ReadableStream === undefined && typeof process !== 'undefined') {
try {
// @ts-ignore
global.ReadableStream = require('node:stream/web').ReadableStream; // ReadableStream is not a global with Node 16
globalThis.ReadableStream = require('node:stream/web').ReadableStream; // ReadableStream is not a global with Node 16
} catch (err) {
console.warn("ReadableStream not defined and unable to import from node:stream/web");
}
Expand Down

0 comments on commit 17349d1

Please sign in to comment.