Skip to content

Commit 2f2a3ec

Browse files
authored
fix undefined global in some environments (#502)
1 parent bed7ffa commit 2f2a3ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

build/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const headRegexp = /(^module.exports = \w+;?)/m
133133
/(?:var|const) (?:{ )Buffer(?: }) = require\('buffer'\)(?:\.Buffer)?;/g
134134
, `
135135
const Buffer = require('buffer').Buffer
136-
const OurUint8Array = global.Uint8Array || function () {}
136+
const OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}
137137
function _uint8ArrayToBuffer(chunk) {
138138
return Buffer.from(chunk);
139139
}

0 commit comments

Comments
 (0)