You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... leading to WhenJS incorrectly concluding that bundled code is running in Node, therefore emitting its events through process.emit (which is a noop) and completely skipping window.dispatchEvent, essentially breaking the global rejection events entirely.
The following is the set of checks I'm using in my code, which appears to be more robust, and which I've found to be working in the current version of Webpack:
Given that the referenced shim explicitly sets process.browser to true, that seems like a better way to identify (bundled) browser environments. I'm not sure whether this property is also present in older versions.
As an aside, the code in initEmitRejection also says the following:
// Returning falsy here means to call the default// onPotentiallyUnhandledRejection API. This is safe even in// browserify since process.emit always returns falsy in browserify:// https://github.com/defunctzombie/node-process/blob/master/browser.js#L40-L46
... however, looking at the current version of that code, this seems to not be true - process.emit is a noop, which thus returns undefined, and I'm not certain that evaluates as 'falsey' from an event handling perspective.
The text was updated successfully, but these errors were encountered:
The code for
initEmitRejection
seems to be checking for a Node environment incorrectly:... leading to WhenJS incorrectly concluding that bundled code is running in Node, therefore emitting its events through
process.emit
(which is a noop) and completely skippingwindow.dispatchEvent
, essentially breaking the global rejection events entirely.The following is the set of checks I'm using in my code, which appears to be more robust, and which I've found to be working in the current version of Webpack:
Given that the referenced shim explicitly sets
process.browser
totrue
, that seems like a better way to identify (bundled) browser environments. I'm not sure whether this property is also present in older versions.As an aside, the code in
initEmitRejection
also says the following:... however, looking at the current version of that code, this seems to not be true -
process.emit
is a noop, which thus returns undefined, and I'm not certain that evaluates as 'falsey' from an event handling perspective.The text was updated successfully, but these errors were encountered: