It appears that in some environments, the global scope is not referencable via our current method:
const globalObject: any = Function('return this')();
In particular when some CSP restrictions are in place. There is a TC39 proposal to make it available and accessible in a consistent place and describes the issue.
We should consider changing this to:
const globalObject: any = function() {
if (typeof self !== 'undefined') {
return self;
}
if (typeof window !== 'undefined') {
return window;
}
if (typeof global !== 'undefined') {
return global;
}
throw new Error('unable to locate global object');
}();
It appears that in some environments, the global scope is not referencable via our current method:
In particular when some CSP restrictions are in place. There is a TC39 proposal to make it available and accessible in a consistent place and describes the issue.
We should consider changing this to: