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
Mobile Safari - issues with globalThis Polyfill #652
Comments
this polyfill is here https://github.com/pinojs/pino/blob/master/browser.js#L309-L319 can you try replacing the polyfill with this and seeing if it works? function polyfillGlobalThis () {
if (typeof globalThis !== 'undefined') return globalThis
Object.defineProperty(Object.prototype, 'globalThis', {
get: function () {
const g = (this.globalThis = this)
delete Object.prototype.globalThis
return g
},
configurable: true
})
return globalThis
} |
and if that doesn't work can you see if this does: function polyfillGlobalThis () {
(function() {
if (typeof globalThis === 'object') return
Object.defineProperty(Object.prototype, '__magic__', {
get: function() {
return this
},
configurable: true
})
__magic__.globalThis = __magic__
delete Object.prototype.__magic__
}())
return globalThis
} |
based on the error they probably won't work - so a fix is in #653 but let me know if they do and we can simplify |
Havn't been able to replicate it yet. Really appreciate the quick turnaround. |
👍 5.12.5 released |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
We updated to the latest release today (as of today 5.12.4). We immediately started receiving
"undefined is not an object (evaluating 'this.globalThis=this')"
for anyone using the site on Mobile Safari.We have reverted to a previous release.
We are using webpack and do not have any other Polyfill for
globalThis
.Is there anyone who would be able to look at this?
The text was updated successfully, but these errors were encountered: